summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2012-05-10 19:28:22 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2012-05-10 19:28:22 (GMT)
commit9169e3286911f102dda285408ce003337967744b (patch)
tree2d854cde94a381e1ed6dcce1baa4dc15b7f32703
parent5fbab3d74e0a2c5d66a5692342f808a006af494e (diff)
Combobox's listview popup colors:
- Use default system colors when combobox has transparent/image background - Always use default system color for listview scrollbar BUG: 299741 FIXED-IN: 4.8.4
-rw-r--r--khtml/css/html4.css4
-rw-r--r--khtml/rendering/render_replaced.cpp29
2 files changed, 17 insertions, 16 deletions
diff --git a/khtml/css/html4.css b/khtml/css/html4.css
index 656e181..9f4d17b 100644
--- a/khtml/css/html4.css
+++ b/khtml/css/html4.css
@@ -441,20 +441,18 @@ select {
font-family: sans-serif;
font-size: small;
color: buttontext;
- background-color: buttonface;
+ background-color: window;
-khtml-background-clip: padding;
box-sizing: border-box;
}
select[multiple],
select[size] {
- background-color: window;
color: windowtext;
}
select[size="0"]:not([multiple]),
select[size="1"]:not([multiple]) {
- background-color: buttonface;
color: buttontext;
}
diff --git a/khtml/rendering/render_replaced.cpp b/khtml/rendering/render_replaced.cpp
index 310e5d9..7bdc638 100644
--- a/khtml/rendering/render_replaced.cpp
+++ b/khtml/rendering/render_replaced.cpp
@@ -403,7 +403,6 @@ void RenderWidget::updateFromElement()
(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 );
@@ -411,16 +410,9 @@ void RenderWidget::updateFromElement()
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() ) {
@@ -465,20 +457,31 @@ void RenderWidget::updateFromElement()
non_trans_pal.setColor(QPalette::Disabled,QPalette::ButtonText,disfg);
}
}
+
+ m_widget->setPalette(pal);
+
+ // Combobox's popup colors
if (qobject_cast<QComboBox*>(m_widget)) {
- m_widget->setPalette(pal);
+ // Background
+ if (style()->hasBackgroundImage()) {
+ non_trans_pal = QApplication::palette();
+ }
+ else if (backgroundColor.isValid() && backgroundColor != Qt::transparent) {
+ non_trans_pal.setColor(QPalette::Base, backgroundColor);
+ }
// 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)) {
+ if (QAbstractScrollArea* lView = qobject_cast<QAbstractScrollArea*>(w)) {
// we have the listview, climb up to reach its container.
assert( w->parentWidget() != m_widget );
- if (w->parentWidget())
+ if (w->parentWidget()) {
w->parentWidget()->setPalette(non_trans_pal);
+ // System colors for scrollbar
+ lView->verticalScrollBar()->setPalette(QApplication::palette());
+ }
}
}
- } else {
- m_widget->setPalette(pal);
}
// Border: