Summary: | [testcase] Rendering failures with selectboxes if <select> tag contains a "background-image" CSS attribute | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Oliver Becker <der.ole.becker> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | frank78ac, germain |
Priority: | NOR | ||
Version: | 4.1.0 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Unspecified | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Reduced test case |
Description
Oliver Becker
2008-09-04 17:56:19 UTC
Created attachment 27242 [details] Reduced test case Thanks for the bug report. I can confirm this on 4.1.1 and trunk rev. 856793. The problem seems to be the CSS attribute 'style="background-image:url(eingabe_back.png);"' in the <select> tag. If I remove it, the rendering seems to be fine. It does not seem to matter if the background image exists or not (the URL of the background image is http://www.ogame.de/img/eingabe_back.png). SVN commit 857217 by ggarand: fix background of the <select> form widget's popup list. When the form widget has an associated bg image, it is assigned a partially transparent palette to let the image show through. That palette used to percolate to the popup list, with interesting visual results. BUG: 170398 M +32 -2 render_replaced.cpp --- trunk/KDE/kdelibs/khtml/rendering/render_replaced.cpp #857216:857217 @@ -410,11 +410,15 @@ if (!backgroundColor.isValid() && !style()->htmlHacks()) backgroundColor = QColor(0,0,0,0); - // check if we have to paint our background and let it show through + // check if we have to paint our background and let it show through the widget bool trans = ( isRedirectedWidget() && style()->backgroundLayers() && style()->backgroundLayers()->hasImage() && !qobject_cast<KUrlRequester*>(m_widget) ); QPalette pal(QApplication::palette(m_widget)); + // We need a non-transparent version for widgets with popups (e.g. kcombobox). The popups must not let + // the background show through. + QPalette non_trans_pal = pal; + if (color.isValid() || backgroundColor.isValid() || trans) { int contrast_ = KGlobalSettings::contrast(); int highlightVal = 100 + (2*contrast_+4)*16/10; @@ -428,6 +432,7 @@ (backgroundColor == colorForCSSValue(CSS_VAL_BUTTONFACE)) ); if (shouldChangeBgPal || trans) { pal.setColor(widget()->backgroundRole(), trans ? QColor(0,0,0,0) : backgroundColor); + non_trans_pal.setColor(widget()->backgroundRole(), backgroundColor); for ( int i = 0; i < QPalette::NColorGroups; ++i ) { if (shouldChangeBgPal) { pal.setColor( (QPalette::ColorGroup)i, QPalette::Window, backgroundColor ); @@ -435,9 +440,16 @@ pal.setColor( (QPalette::ColorGroup)i, QPalette::Dark, backgroundColor.dark(lowlightVal) ); pal.setColor( (QPalette::ColorGroup)i, QPalette::Mid, backgroundColor.dark(120) ); pal.setColor( (QPalette::ColorGroup)i, QPalette::Midlight, backgroundColor.light(110) ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Window, backgroundColor ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Light, backgroundColor.light(highlightVal) ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Dark, backgroundColor.dark(lowlightVal) ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Mid, backgroundColor.dark(120) ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Midlight, backgroundColor.light(110) ); } pal.setColor( (QPalette::ColorGroup)i, QPalette::Button, trans ? QColor(0,0,0,0):backgroundColor ); pal.setColor( (QPalette::ColorGroup)i, QPalette::Base, trans ? QColor(0,0,0,0):backgroundColor ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Button, backgroundColor ); + non_trans_pal.setColor( (QPalette::ColorGroup)i, QPalette::Base, backgroundColor ); } } if ( color.isValid() ) { @@ -457,6 +469,7 @@ const ColorSet *set = toSet; while( set->cg != QPalette::NColorGroups ) { pal.setColor( set->cg, set->cr, color ); + non_trans_pal.setColor( set->cg, set->cr, color ); ++set; } @@ -476,9 +489,26 @@ pal.setColor(QPalette::Disabled,QPalette::Foreground,disfg); pal.setColor(QPalette::Disabled,QPalette::Text,disfg); pal.setColor(QPalette::Disabled,QPalette::ButtonText,disfg); + non_trans_pal.setColor(QPalette::Disabled,QPalette::Foreground,disfg); + non_trans_pal.setColor(QPalette::Disabled,QPalette::Text,disfg); + non_trans_pal.setColor(QPalette::Disabled,QPalette::ButtonText,disfg); } } - m_widget->setPalette(pal); + if (qobject_cast<QComboBox*>(m_widget)) { + m_widget->setPalette(pal); + // mmh great, there's no accessor for the popup... + QList<QWidget*>l = qFindChildren<QWidget *>(m_widget, QString()); + foreach(QWidget* w, l) { + if (qobject_cast<QAbstractScrollArea*>(w)) { + // we have the listview, climb up to reach its container. + assert( w->parentWidget() != m_widget ); + if (w->parentWidget()) + w->parentWidget()->setPalette(non_trans_pal); + } + } + } else { + m_widget->setPalette(pal); + } // Border: if (shouldPaintBorder()) |