diff --git a/kdelibs-4.0.4-khtml-DOMStyleSheetList.patch b/kdelibs-4.0.4-khtml-DOMStyleSheetList.patch
new file mode 100644
index 0000000..c3ea82f
--- /dev/null
+++ b/kdelibs-4.0.4-khtml-DOMStyleSheetList.patch
@@ -0,0 +1,11 @@
+--- branches/KDE/4.0/kdelibs/khtml/ecma/kjs_css.cpp 2008/05/25 17:43:12 812537
++++ branches/KDE/4.0/kdelibs/khtml/ecma/kjs_css.cpp 2008/05/25 17:44:08 812538
+@@ -421,7 +421,7 @@
+ #ifdef KJS_VERBOSE
+ kDebug(6070) << "DOMStyleSheetList::getOwnPropertySlot " << propertyName.qstring();
+ #endif
+- if (getStaticOwnPropertySlot(&DOMStyleSheetTable, this, propertyName, slot))
++ if (getStaticOwnPropertySlot(&DOMStyleSheetListTable, this, propertyName, slot))
+ return true;
+
+ StyleSheetListImpl &styleSheetList = *m_impl;
diff --git a/kdelibs-4.0.4-khtml-anonboxes.patch b/kdelibs-4.0.4-khtml-anonboxes.patch
new file mode 100644
index 0000000..04435c1
--- /dev/null
+++ b/kdelibs-4.0.4-khtml-anonboxes.patch
@@ -0,0 +1,91 @@
+--- kdelibs/khtml/rendering/render_body.cpp 2008/05/26 18:13:43 812954
++++ kdelibs/khtml/rendering/render_body.cpp 2008/05/26 18:15:46 812955
+@@ -51,7 +51,7 @@
+ style->setPosition(STATIC);
+
+ RenderBlock::setStyle(style);
+- element()->getDocument()->setTextColor( style->color() );
++ document()->setTextColor( style->color() );
+ scrollbarsStyled = false;
+ }
+
+--- kdelibs/khtml/rendering/render_box.cpp 2008/05/26 18:13:43 812954
++++ kdelibs/khtml/rendering/render_box.cpp 2008/05/26 18:15:46 812955
+@@ -2364,7 +2364,7 @@
+
+ QWheelEvent we(p, -me.detail()*40, buttons, state, orient);
+ KHTMLAssert(layer());
+- KHTMLView* v = element()->getDocument()->view();
++ KHTMLView* v = document()->view();
+ if ( ((orient == Qt::Vertical && (v->contentsHeight() > v->visibleHeight())) ||
+ (orient == Qt::Horizontal && (v->contentsWidth() > v->visibleWidth()))) &&
+ v->isScrollingFromMouseWheel() ) {
+--- kdelibs/khtml/rendering/render_layer.cpp 2008/05/26 18:13:43 812954
++++ kdelibs/khtml/rendering/render_layer.cpp 2008/05/26 18:15:46 812955
+@@ -368,7 +368,7 @@
+ bool needUpdate = false;
+ KHTMLView* sa = 0;
+ if (count) {
+- sa = m_object->element()->getDocument()->view();
++ sa = m_object->document()->view();
+ m_region = QRect(0,0,sa->contentsWidth(),sa->contentsHeight());
+ for (uint i = 0; i < count; i++) {
+ RenderLayer* child = m_posZOrderList->at(i);
+@@ -390,7 +390,7 @@
+ found |= sc->m_negZOrderList->at(i)->zIndex() > zx;
+ if (found) {
+ if (!sa) {
+- sa = m_object->element()->getDocument()->view();
++ sa = m_object->document()->view();
+ m_region = QRect(0,0,sa->contentsWidth(),sa->contentsHeight());
+ }
+ m_region -= sc->m_negZOrderList->at(i)->paintedRegion(rootLayer);
+@@ -403,7 +403,7 @@
+ found |= sc->m_posZOrderList->at(i)->zIndex() > zx;
+ if (found) {
+ if (!sa) {
+- sa = m_object->element()->getDocument()->view();
++ sa = m_object->document()->view();
+ m_region = QRect(0,0,sa->contentsWidth(),sa->contentsHeight());
+ }
+ m_region -= sc->m_posZOrderList->at(i)->paintedRegion(rootLayer);
+@@ -757,7 +757,7 @@
+ ScrollBarWidget *sb = (o == Qt::Horizontal) ? m_hBar : m_vBar;
+
+ if (show && !sb) {
+- KHTMLView* view = m_object->element()->getDocument()->view();
++ KHTMLView* view = m_object->document()->view();
+ sb = new ScrollBarWidget(o, view->widget());
+ sb->move(0, -50000);
+ sb->setAttribute(Qt::WA_NoSystemBackground);
+@@ -977,7 +977,7 @@
+ {
+ if (paintDirtyRect == clipRect)
+ return;
+- KHTMLView* v = m_object->element()->getDocument()->view();
++ KHTMLView* v = m_object->document()->view();
+ if (v->clipHolder() && !v->clipHolder()->isEmpty())
+ p->setClipRegion( v->clipHolder()->pop() );
+ else
+--- kdelibs/khtml/rendering/render_line.cpp 2008/05/26 18:13:43 812954
++++ kdelibs/khtml/rendering/render_line.cpp 2008/05/26 18:15:46 812955
+@@ -483,7 +483,7 @@
+ RenderObject* curr = object();
+ while (curr && !curr->element())
+ curr = curr->container();
+- bool strictMode = (curr && curr->element()->getDocument()->inStrictMode());
++ bool strictMode = (curr && curr->document()->inStrictMode());
+
+ computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode);
+
+--- kdelibs/khtml/rendering/render_replaced.cpp 2008/05/26 18:13:43 812954
++++ kdelibs/khtml/rendering/render_replaced.cpp 2008/05/26 18:15:46 812955
+@@ -744,7 +744,7 @@
+ filtered = true; //We already delivered it!
+
+ //kDebug(6000) << "RenderWidget::eventFilter captures FocusIn";
+- element()->getDocument()->setFocusNode(element());
++ document()->setFocusNode(element());
+ // if ( isEditable() ) {
+ // KHTMLPartBrowserExtension *ext = static_cast( element()->view->part()->browserExtension() );
+ // if ( ext ) ext->editableWidgetFocused( m_widget );
diff --git a/kdelibs-4.0.4-khtml-combobox.patch b/kdelibs-4.0.4-khtml-combobox.patch
new file mode 100644
index 0000000..0c76788
--- /dev/null
+++ b/kdelibs-4.0.4-khtml-combobox.patch
@@ -0,0 +1,34 @@
+--- kdelibs/khtml/html/html_formimpl.cpp 2008/05/26 19:24:36 812984
++++ kdelibs/khtml/html/html_formimpl.cpp 2008/05/26 19:26:19 812985
+@@ -2608,21 +2608,17 @@
+
+ DOMString HTMLOptionElementImpl::text() const
+ {
+- if (firstChild() && firstChild()->nodeType() == Node::TEXT_NODE) {
+- if (firstChild()->nextSibling()) {
+- DOMString ret = "";
+- NodeImpl *n = firstChild();
+- for (; n; n = n->nextSibling()) {
+- if (n->nodeType() == Node::TEXT_NODE ||
+- n->nodeType() == Node::CDATA_SECTION_NODE)
+- ret += n->nodeValue();
+- }
+- return ret;
+- }
+- else
+- return firstChild()->nodeValue();
++ if (firstChild() && firstChild()->nodeType() == Node::TEXT_NODE && !firstChild()->nextSibling())
++ return firstChild()->nodeValue();
++
++ DOMString ret = "";
++ NodeImpl *n = firstChild();
++ for (; n; n = n->nextSibling()) {
++ if (n->nodeType() == Node::TEXT_NODE ||
++ n->nodeType() == Node::CDATA_SECTION_NODE)
++ ret += n->nodeValue();
+ }
+- return "";
++ return ret;
+ }
+
+ long HTMLOptionElementImpl::index() const
diff --git a/kdelibs.spec b/kdelibs.spec
index 5dd9521..a090168 100644
--- a/kdelibs.spec
+++ b/kdelibs.spec
@@ -1,7 +1,7 @@
Summary: K Desktop Environment 4 - Libraries
Version: 4.0.4
-Release: 8%{?dist}
+Release: 9%{?dist}
%if 0%{?fedora} > 8
Name: kdelibs
@@ -86,7 +86,17 @@ Patch16: kdelibs-4.0.4-phonon-hal.patch
Patch17: kdelibs-4.0.4-remote-encoding.patch
# forward port kstandarddirs hack to search /etc/kde
Patch18: kdelibs-4.0.4-kstandarddirs.patch
+#447840: Konquerorsu crash in KDE 4
Patch19: kdelibs-4.0.4-kdesu.patch
+# fix kdebug:161196: Drop-down list options display blank when a comment is added between option tags
+# http://websvn.kde.org/?view=rev&revision=812985
+Patch20: kdelibs-4.0.4-khtml-combobox.patch
+# fix kdebug:156419: konqueror crash on http://pidgin.im
+# http://websvn.kde.org/?view=rev&revision=812954
+Patch21: kdelibs-4.0.4-khtml-anonboxes.patch
+# fix kdebug:48704: document.styleSheets.length does not return the correct number under all circumstances
+# http://websvn.kde.org/?view=rev&revision=812538
+Patch22: kdelibs-4.0.4-khtml-DOMStyleSheetList.patch
## upstream patches
@@ -210,7 +220,9 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%patch17 -p1 -b .remote-encoding
%patch18 -p1 -b .kstandarddirs
%patch19 -p1 -b .kdesu
-
+%patch20 -p1 -b .khtml-combobox
+%patch21 -p1 -b .khtml-anonboxes
+%patch22 -p1 -b .khtml-DOMStyleSheetList
%build
@@ -371,6 +383,11 @@ rm -rf %{buildroot}
%changelog
+* Tue May 27 2008 Lukáš Tinkl - 4.0.4-9
+- fix kdebug:161196: Drop-down list options display blank when a comment is added between option tags
+- fix kdebug:156419: konqueror crash on http://pidgin.im/
+- fix kdebug:48704 document.styleSheets.length does not return the correct number under all circumstances
+
* Fri May 23 2008 Kevin Kofler - 4.0.4-8
- keep libphonon.so in %%{_libdir} for non-KDE apps (#447831)