A never ending story.

Michael Reiher michael.reiher at gmx.de
Sat Sep 28 16:53:48 BST 2002


Michael Reiher schrieb:
> 
> Hi!
> 
> Short version:
> 
> I know I might perhaps be annoying, but those problems with inverted widget
> colors and sane defaults, where colors are not explicitly set, still persist.
> Dirk made some changes which fixed a few cases but others still remained. I
> made a patch now from which I think it solves the problem at the root and in a
> more general way. I can only say that it works perfectly for me and fixes all
> my test cases.
> 
> Patch attached.
> 

Hi,

A little update:

I made some updates to work with current CVS. 

New patch attached.

rendering/render_form.cpp
- Fix for a fix by Dirk to restore the normal widget palette on the lost of
focus. Use viewport palette instead widget class default palette(i.e.
application palette).

html/html_baseimpl.cpp
- Removed a (IMHO) hack once made by Dirk to fix the inverted widget colors
problem. It's not needed anymore.

khtml_settings.h
- Restored bincompat by readding previously removed functions.

khtmldefaults.h
- Removed some obsolete #defines.

Greets

Michael
-------------- next part --------------
? colorfix.diff
Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.750
diff -b -u -p -r1.750 khtml_part.cpp
--- khtml_part.cpp	2002/09/25 15:09:11	1.750
+++ khtml_part.cpp	2002/09/28 15:09:41
@@ -164,6 +164,8 @@ void KHTMLPart::init( KHTMLView *view, G
 
   d->m_view = view;
   setWidget( d->m_view );
+  d->m_view->viewport()->setPalette( d->m_settings->htmlPalette() );
+  kdDebug() << "KHTMLPart::init ###### Palette Button: " << d->m_view->viewport()->palette().active().color(QColorGroup::Button).name() << endl;
 
   d->m_guiProfile = prof;
   d->m_extension = new KHTMLPartBrowserExtension( this );
Index: khtml_settings.cc
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_settings.cc,v
retrieving revision 1.88
diff -b -u -p -r1.88 khtml_settings.cc
--- khtml_settings.cc	2002/07/19 19:06:14	1.88
+++ khtml_settings.cc	2002/09/28 15:09:42
@@ -19,6 +19,7 @@
 
 #include <qfontdatabase.h>
 #include <qregexp.h>
+#include <qpalette.h>
 
 #include "khtml_settings.h"
 #include "khtmldefaults.h"
@@ -26,6 +27,7 @@
 #include <kconfig.h>
 #include <kglobal.h>
 #include <klocale.h>
+#include <kapplication.h>
 #include <kdebug.h>
 #include <qregexp.h>
 
@@ -55,9 +57,7 @@ public:
     QString m_encoding;
     QString m_userSheet;
 
-    QColor m_textColor;
-    QColor m_linkColor;
-    QColor m_vLinkColor;
+    QPalette m_htmlPalette;
 
     QMap<QString,KHTMLSettings::KJavaScriptAdvice> javaDomainPolicy;
     QMap<QString,KHTMLSettings::KJavaScriptAdvice> javaScriptDomainPolicy;
@@ -245,21 +245,89 @@ void KHTMLSettings::init( KConfig * conf
     d->m_maxFormCompletionItems = config->readNumEntry("MaxFormCompletionItems", 10);
   }
 
-  // Colors
-  if ( reset || config->hasGroup( "General" ) )
+  // Local HTML palette ( code taken from KApplication )
+  if ( reset || config->hasGroup( "HTML Colors" ) )
   {
-    config->setGroup( "General" ); // group will be restored by cgs anyway
-    if ( reset || config->hasKey( "foreground" ) )
-      d->m_textColor = config->readColorEntry( "foreground", &HTML_DEFAULT_TXT_COLOR );
+    config->setGroup( "HTML Colors" );
 
-    if ( reset || config->hasKey( "linkColor" ) )
-      d->m_linkColor = config->readColorEntry( "linkColor", &HTML_DEFAULT_LNK_COLOR );
+    int contrast_ = KGlobalSettings::contrast();
+    const QPalette &defaultPal = kapp->palette();
 
-    if ( reset || config->hasKey( "visitedLinkColor" ) )
-      d->m_vLinkColor = config->readColorEntry( "visitedLinkColor", &HTML_DEFAULT_VLNK_COLOR);
-  }
+    QColor background = config->readColorEntry( "background", &defaultPal.active().background() );
+    QColor foreground = config->readColorEntry( "foreground", &defaultPal.active().foreground() );
+    QColor button = config->readColorEntry( "buttonBackground", &background );
+    QColor buttonText = config->readColorEntry( "buttonForeground", &foreground );
+    QColor highlight = config->readColorEntry( "selectBackground", &defaultPal.active().highlight() );
+    QColor highlightedText = config->readColorEntry( "selectForeground", &defaultPal.active().highlightedText() );
+    QColor base = config->readColorEntry( "windowBackground", &defaultPal.active().base() );
+    QColor baseText = config->readColorEntry( "windowForeground", &defaultPal.active().text() );
+    QColor link = config->readColorEntry( "linkColor", &defaultPal.active().link() );
+    QColor visitedLink = config->readColorEntry( "visitedLinkColor", &defaultPal.active().linkVisited() );
+
+    int highlightVal = 100 + (2*contrast_+4)*16/10;
+    int lowlightVal = 100 + (2*contrast_+4)*10;
+
+    QColor disfg = foreground;
+
+    int h, s, v;
+    disfg.hsv( &h, &s, &v );
+    if (v > 128)
+      // dark bg, light fg - need a darker disabled fg
+      disfg = disfg.dark(lowlightVal);
+    else if (disfg != Qt::black)
+      // light bg, dark fg - need a lighter disabled fg - but only if !black
+      disfg = disfg.light(highlightVal);
+    else
+      // black fg - use darkgrey disabled fg
+      disfg = Qt::darkGray;
+
+
+    QColorGroup disabledgrp(disfg, background,
+                            background.light(highlightVal),
+                            background.dark(lowlightVal),
+                            background.dark(120),
+                            background.dark(120), base);
+
+    QColorGroup colgrp(foreground, background, background.light(highlightVal),
+                       background.dark(lowlightVal),
+                       background.dark(120),
+                       baseText, base);
+
+    int inlowlightVal = lowlightVal-25;
+    if(inlowlightVal < 120)
+      inlowlightVal = 120;
+
+    colgrp.setColor(QColorGroup::Highlight, highlight);
+    colgrp.setColor(QColorGroup::HighlightedText, highlightedText);
+    colgrp.setColor(QColorGroup::Button, button);
+    colgrp.setColor(QColorGroup::ButtonText, buttonText);
+    colgrp.setColor(QColorGroup::Midlight, background.light(110));
+    colgrp.setColor(QColorGroup::Link, link);
+    colgrp.setColor(QColorGroup::LinkVisited, visitedLink);
+
+    disabledgrp.setColor(QColorGroup::Button, button);
+
+    QColor disbtntext = buttonText;
+    disbtntext.hsv( &h, &s, &v );
+    if (v > 128)
+      // dark button, light buttonText - need a darker disabled buttonText
+      disbtntext = disbtntext.dark(lowlightVal);
+    else if (disbtntext != Qt::black)
+      // light buttonText, dark button - need a lighter disabled buttonText - but only if !black
+      disbtntext = disbtntext.light(highlightVal);
+    else
+      // black button - use darkgrey disabled buttonText
+      disbtntext = Qt::darkGray;
 
+    disabledgrp.setColor(QColorGroup::ButtonText, disbtntext);
+    disabledgrp.setColor(QColorGroup::Midlight, background.light(110));
+    disabledgrp.setColor(QColorGroup::Link, link);
+    disabledgrp.setColor(QColorGroup::LinkVisited, visitedLink);
 
+    d->m_htmlPalette = QPalette(colgrp, disabledgrp, colgrp);
+    kdDebug() << "KHTMLSettings::init ###### Palette Base: " << d->m_htmlPalette.active().color(QColorGroup::Base).name() << endl;
+  }
+
   if( reset || config->hasGroup( "Java/JavaScript Settings" ) )
   {
     config->setGroup( "Java/JavaScript Settings" );
@@ -445,7 +513,7 @@ QString KHTMLSettings::settingsToCSS() c
 {
     // lets start with the link properties
     QString str = "a:link {\ncolor: ";
-    str += d->m_linkColor.name();
+    str += d->m_htmlPalette.active().color(QColorGroup::Link).name();
     str += ";";
     if(d->m_underlineLink)
         str += "\ntext-decoration: underline;";
@@ -457,7 +525,7 @@ QString KHTMLSettings::settingsToCSS() c
     }
     str += "\n}\n";
     str += "a:visited {\ncolor: ";
-    str += d->m_vLinkColor.name();
+    str += d->m_htmlPalette.active().color(QColorGroup::LinkVisited).name();
     str += ";";
     if(d->m_underlineLink)
         str += "\ntext-decoration: underline;";
@@ -571,17 +639,22 @@ const QString &KHTMLSettings::encoding()
 
 const QColor& KHTMLSettings::textColor() const
 {
-  return d->m_textColor;
+  return d->m_htmlPalette.active().color(QColorGroup::Foreground);
 }
 
 const QColor& KHTMLSettings::linkColor() const
 {
-  return d->m_linkColor;
+  return d->m_htmlPalette.active().color(QColorGroup::Link);
 }
 
 const QColor& KHTMLSettings::vLinkColor() const
+{
+  return d->m_htmlPalette.active().color(QColorGroup::LinkVisited);
+}
+
+const QPalette& KHTMLSettings::htmlPalette() const
 {
-  return d->m_vLinkColor;
+  return d->m_htmlPalette;
 }
 
 bool KHTMLSettings::autoLoadImages() const
Index: khtml_settings.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_settings.h,v
retrieving revision 1.33
diff -b -u -p -r1.33 khtml_settings.h
--- khtml_settings.h	2002/07/19 19:06:14	1.33
+++ khtml_settings.h	2002/09/28 15:09:42
@@ -97,9 +97,10 @@ public:
     const QString &encoding() const;
 
     // Color settings
-    const QColor& textColor() const;
-    const QColor& linkColor() const;
-    const QColor& vLinkColor() const;
+    const QColor& textColor() const; // obsolete, use htmlPalette()
+    const QColor& linkColor() const; // obsolete, use htmlPalette()
+    const QColor& vLinkColor() const; // obsolete, use htmlPalette()
+    const QPalette& htmlPalette() const;
 
     // Autoload images
     bool autoLoadImages() const;
Index: khtmldefaults.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtmldefaults.h,v
retrieving revision 1.5
diff -b -u -p -r1.5 khtmldefaults.h
--- khtmldefaults.h	2000/07/06 14:04:34	1.5
+++ khtmldefaults.h	2002/09/28 15:09:42
@@ -18,11 +18,6 @@
    Boston, MA 02111-1307, USA.
 */
 
-// browser window color defaults -- Bernd
-#define HTML_DEFAULT_LNK_COLOR Qt::blue
-#define HTML_DEFAULT_TXT_COLOR Qt::black
-#define HTML_DEFAULT_VLNK_COLOR Qt::magenta
-
 // KEEP IN SYNC WITH konqdefaults.h in kdebase/libkonq!
 // lets be modern .. -- Bernd
 #define HTML_DEFAULT_VIEW_FONT "helvetica"
Index: html/html_baseimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_baseimpl.cpp,v
retrieving revision 1.166
diff -b -u -p -r1.166 html_baseimpl.cpp
--- html/html_baseimpl.cpp	2002/08/23 18:44:44	1.166
+++ html/html_baseimpl.cpp	2002/09/28 15:09:43
@@ -172,9 +172,6 @@ void HTMLBodyElementImpl::insertedIntoDo
         addCSSLength(CSS_PROP_MARGIN_BOTTOM, s);
     }
 
-    if ( m_bgSet && !m_fgSet )
-        addCSSProperty(CSS_PROP_COLOR, "#000000");
-
     if (m_styleSheet)
         getDocument()->updateStyleSelector();
 }
Index: html/html_formimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v
retrieving revision 1.291
diff -b -u -p -r1.291 html_formimpl.cpp
--- html/html_formimpl.cpp	2002/09/27 07:40:07	1.291
+++ html/html_formimpl.cpp	2002/09/28 15:09:44
@@ -1071,9 +1071,11 @@ void HTMLInputElementImpl::attach()
     case SUBMIT:
     case RESET:
     case BUTTON:
+        addCSSProperty(CSS_PROP_COLOR, "buttontext");
+        break;
     case CHECKBOX:
     case RADIO:
-        addCSSProperty(CSS_PROP_COLOR, "buttontext" );
+        addCSSProperty(CSS_PROP_COLOR, "text" );
     case HIDDEN:
     case IMAGE:
         if (!getAttribute(ATTR_WIDTH).isNull())
Index: misc/helper.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/misc/helper.cpp,v
retrieving revision 1.49
diff -b -u -p -r1.49 helper.cpp
--- misc/helper.cpp	2002/09/25 15:42:07	1.49
+++ misc/helper.cpp	2002/09/28 15:09:45
@@ -30,6 +30,8 @@
 #include <kstaticdeleter.h>
 #include <kapplication.h>
 #include <kconfig.h>
+#include <kglobalsettings.h>
+#include <kdebug.h>
 #include <qtooltip.h>
 
 using namespace DOM;
@@ -64,83 +66,164 @@ static const colorMap cmap[] = {
 
 struct uiColors {
     const char * name;
-    const char * configGroup;
-    const char * configEntry;
     QPalette::ColorGroup group;
     QColorGroup::ColorRole role;
 };
 
-const char * const wmgroup = "WM";
-const char * const generalgroup = "General";
-
 static const uiColors uimap[] = {
 	// Active window border.
-    { "activeborder", wmgroup, "background", QPalette::Active, QColorGroup::Light },
+    { "activeborder", QPalette::Active, QColorGroup::Light },
 	// Active window caption.
-    { "activecaption", wmgroup, "background", QPalette::Active, QColorGroup::Text },
+    { "activecaption", QPalette::Active, QColorGroup::Text },
         // Text in caption, size box, and scrollbar arrow box.
-    { "captiontext", wmgroup, "activeForeground", QPalette::Active, QColorGroup::Text },
+    { "captiontext", QPalette::Active, QColorGroup::Text },
 	// Face color for three-dimensional display elements.
-    { "buttonface", wmgroup, 0, QPalette::Inactive, QColorGroup::Button },
+    { "buttonface", QPalette::Inactive, QColorGroup::Button }, // MR: shouldn't this be QColorGroup::ButtonText
 	// Dark shadow for three-dimensional display elements (for edges facing away from the light source).
-    { "buttonhighlight", wmgroup, 0, QPalette::Inactive, QColorGroup::Light },
+    { "buttonhighlight", QPalette::Inactive, QColorGroup::Light },
 	// Shadow color for three-dimensional display elements.
-    { "buttonshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Shadow },
+    { "buttonshadow", QPalette::Inactive, QColorGroup::Shadow },
 	// Text on push buttons.
-    { "buttontext", wmgroup, "buttonForeground", QPalette::Inactive, QColorGroup::ButtonText },
+    { "buttontext", QPalette::Inactive, QColorGroup::ButtonText },
 	// Dark shadow for three-dimensional display elements.
-    { "threeddarkshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Dark },
+    { "threeddarkshadow", QPalette::Inactive, QColorGroup::Dark },
 	// Face color for three-dimensional display elements.
-    { "threedface", wmgroup, 0, QPalette::Inactive, QColorGroup::Button },
+    { "threedface", QPalette::Inactive, QColorGroup::Button }, // MR: shouldn't this be QColorGroup::ButtonText
 	// Highlight color for three-dimensional display elements.
-    { "threedhighlight", wmgroup, 0, QPalette::Inactive, QColorGroup::Light },
+    { "threedhighlight", QPalette::Inactive, QColorGroup::Light },
 	// Light color for three-dimensional display elements (for edges facing the light source).
-    { "threedlightshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Midlight },
+    { "threedlightshadow", QPalette::Inactive, QColorGroup::Midlight },
 	// Dark shadow for three-dimensional display elements.
-    { "threedshadow", wmgroup, 0, QPalette::Inactive, QColorGroup::Shadow },
+    { "threedshadow", QPalette::Inactive, QColorGroup::Shadow },
 
     // Inactive window border.
-    { "inactiveborder", wmgroup, "background", QPalette::Disabled, QColorGroup::Background },
+    { "inactiveborder", QPalette::Disabled, QColorGroup::Background },
     // Inactive window caption.
-    { "inactivecaption", wmgroup, "inactiveBackground", QPalette::Disabled, QColorGroup::Background },
+    { "inactivecaption", QPalette::Disabled, QColorGroup::Background },
     // Color of text in an inactive caption.
-    { "inactivecaptiontext", wmgroup, "inactiveForeground", QPalette::Disabled, QColorGroup::Text },
-    { "graytext", wmgroup, 0, QPalette::Disabled, QColorGroup::Text },
+    { "inactivecaptiontext", QPalette::Disabled, QColorGroup::Text },
+    { "graytext", QPalette::Disabled, QColorGroup::Text },
 
 	// Menu background
-    { "menu", generalgroup, "background", QPalette::Inactive, QColorGroup::Background },
+    { "menu", QPalette::Inactive, QColorGroup::Background },
 	// Text in menus
-    { "menutext", generalgroup, "foreground", QPalette::Inactive, QColorGroup::Background },
+    { "menutext", QPalette::Inactive, QColorGroup::Background }, // MR: shouldn't this be QColorGroup::Foreground
 
         // Text of item(s) selected in a control.
-    { "highlight", generalgroup, "selectBackground", QPalette::Inactive, QColorGroup::Background },
+    { "highlight", QPalette::Inactive, QColorGroup::Background }, // MR: shouldn't this be QColorGroup::Highlight
 
     // Text of item(s) selected in a control.
-    { "highlighttext", generalgroup, "selectForeground", QPalette::Inactive, QColorGroup::Background },
+    { "highlighttext", QPalette::Inactive, QColorGroup::Background }, // MR: shouldn't this be QColorGroup::HighlightedText
 
 	// Background color of multiple document interface.
-    { "appworkspace", generalgroup, "background", QPalette::Inactive, QColorGroup::Text },
+    { "appworkspace", QPalette::Inactive, QColorGroup::Text }, // MR: shouldn't this be QColorGroup::Base
 
 	// Scroll bar gray area.
-    { "scrollbar", generalgroup, "background", QPalette::Inactive, QColorGroup::Background },
+    { "scrollbar", QPalette::Inactive, QColorGroup::Background },
 
 	// Window background.
-    { "window", generalgroup, "windowBackground", QPalette::Inactive, QColorGroup::Background },
+    { "window", QPalette::Inactive, QColorGroup::Background },
 	// Window frame.
-    { "windowframe", generalgroup, "windowBackground", QPalette::Inactive, QColorGroup::Background },
+    { "windowframe", QPalette::Inactive, QColorGroup::Background },
         // WindowText
-    { "windowtext", generalgroup, "windowForeground", QPalette::Inactive, QColorGroup::Text },
-    { "text", generalgroup, 0, QPalette::Inactive, QColorGroup::Text },
-    { 0, 0, 0, QPalette::NColorGroups, QColorGroup::NColorRoles }
+    { "windowtext", QPalette::Inactive, QColorGroup::Text }, // MR: shouldn't this be QColorGroup::Foreground
+    { "text", QPalette::Inactive, QColorGroup::Text },
+    { 0, QPalette::NColorGroups, QColorGroup::NColorRoles }
 };
 
 HTMLColors::HTMLColors()
 {
+  // Local HTML palette ( code taken from KApplication )
+  KConfig *config = KGlobal::config();
+  QString lastConfigGroup = config->group();
+  config->setGroup( "HTML Colors" );
+
+  int contrast_ = KGlobalSettings::contrast();
+  const QPalette &defaultPal = kapp->palette();
+
+  QColor background = config->readColorEntry( "background", &defaultPal.active().background() );
+  QColor foreground = config->readColorEntry( "foreground", &defaultPal.active().foreground() );
+  QColor button = config->readColorEntry( "buttonBackground", &background );
+  QColor buttonText = config->readColorEntry( "buttonForeground", &foreground );
+  QColor highlight = config->readColorEntry( "selectBackground", &defaultPal.active().highlight() );
+  QColor highlightedText = config->readColorEntry( "selectForeground", &defaultPal.active().highlightedText() );
+  QColor base = config->readColorEntry( "windowBackground", &defaultPal.active().base() );
+  QColor baseText = config->readColorEntry( "windowForeground", &defaultPal.active().text() );
+  QColor link = config->readColorEntry( "linkColor", &defaultPal.active().link() );
+  QColor visitedLink = config->readColorEntry( "visitedLinkColor", &defaultPal.active().linkVisited() );
+
+  int highlightVal = 100 + (2*contrast_+4)*16/10;
+  int lowlightVal = 100 + (2*contrast_+4)*10;
+
+  QColor disfg = foreground;
+
+  int h, s, v;
+  disfg.hsv( &h, &s, &v );
+  if (v > 128)
+    // dark bg, light fg - need a darker disabled fg
+    disfg = disfg.dark(lowlightVal);
+  else if (disfg != Qt::black)
+    // light bg, dark fg - need a lighter disabled fg - but only if !black
+    disfg = disfg.light(highlightVal);
+  else
+    // black fg - use darkgrey disabled fg
+    disfg = Qt::darkGray;
+
+
+  QColorGroup disabledgrp(disfg, background,
+                          background.light(highlightVal),
+                          background.dark(lowlightVal),
+                          background.dark(120),
+                          background.dark(120), base);
+
+  QColorGroup colgrp(foreground, background, background.light(highlightVal),
+                     background.dark(lowlightVal),
+                     background.dark(120),
+                     baseText, base);
+
+  int inlowlightVal = lowlightVal-25;
+  if(inlowlightVal < 120)
+    inlowlightVal = 120;
+
+  colgrp.setColor(QColorGroup::Highlight, highlight);
+  colgrp.setColor(QColorGroup::HighlightedText, highlightedText);
+  colgrp.setColor(QColorGroup::Button, button);
+  colgrp.setColor(QColorGroup::ButtonText, buttonText);
+  colgrp.setColor(QColorGroup::Midlight, background.light(110));
+  colgrp.setColor(QColorGroup::Link, link);
+  colgrp.setColor(QColorGroup::LinkVisited, visitedLink);
+
+  disabledgrp.setColor(QColorGroup::Button, button);
+
+  QColor disbtntext = buttonText;
+  disbtntext.hsv( &h, &s, &v );
+  if (v > 128)
+    // dark button, light buttonText - need a darker disabled buttonText
+    disbtntext = disbtntext.dark(lowlightVal);
+  else if (disbtntext != Qt::black)
+    // light buttonText, dark button - need a lighter disabled buttonText - but only if !black
+    disbtntext = disbtntext.light(highlightVal);
+  else
+    // black button - use darkgrey disabled buttonText
+    disbtntext = Qt::darkGray;
+
+  disabledgrp.setColor(QColorGroup::ButtonText, disbtntext);
+  disabledgrp.setColor(QColorGroup::Midlight, background.light(110));
+  disabledgrp.setColor(QColorGroup::Link, link);
+  disabledgrp.setColor(QColorGroup::LinkVisited, visitedLink);
+
+  QPalette htmlPal(colgrp, disabledgrp, colgrp);
+  kdDebug() << "HTMLColors::HTMLColors ###### Palette Base: " << htmlPal.active().color(QColorGroup::Base).name() << endl;
+
+  config->setGroup( lastConfigGroup );
+
+
     const colorMap *color = cmap;
     while ( color->name ) {
 	map[color->name] = color->value;
 	++color;
     }
+
     // ### react to style changes
     // see http://www.richinstyle.com for details
 
@@ -148,19 +231,9 @@ HTMLColors::HTMLColors()
      * Tried hard to get an appropriate mapping - schlpbch
      */
 
-    KConfig *globalConfig = KGlobal::config();
-    const QPalette &pal = kapp->palette();
-
     const uiColors *uicol = uimap;
-    const char *lastConfigGroup = 0;
     while( uicol->name ) {
-	if ( lastConfigGroup != uicol->configGroup ) {
-	    lastConfigGroup = uicol->configGroup;
-	    globalConfig->setGroup( lastConfigGroup );
-	}
-	QColor c = pal.color( uicol->group, uicol->role );
-	if ( uicol->configEntry )
-	    c = globalConfig->readColorEntry( uicol->configEntry, &c );
+    QColor c = htmlPal.color( uicol->group, uicol->role );
 	map[uicol->name] = c;
 	++uicol;
     }
@@ -175,7 +248,7 @@ HTMLColors::HTMLColors()
     KConfig bckgrConfig("kdesktoprc", true, false); // No multi-screen support
     bckgrConfig.setGroup("Desktop0");
         // Desktop background.
-    map["background"] = bckgrConfig.readColorEntry("Color1", &pal.disabled().background());
+  map["background"] = bckgrConfig.readColorEntry("Color1", &htmlPal.disabled().background());
 };
 
 
Index: rendering/render_form.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.cpp,v
retrieving revision 1.193
diff -b -u -p -r1.193 render_form.cpp
--- rendering/render_form.cpp	2002/09/26 23:24:50	1.193
+++ rendering/render_form.cpp	2002/09/28 15:09:46
@@ -94,7 +94,7 @@ void RenderFormElement::updateFromElemen
     QColor backgroundColor = style()->backgroundColor();
 
     if ( color.isValid() || backgroundColor.isValid() ) {
-        QPalette pal(QApplication::palette(m_widget));
+        QPalette pal(view()->viewport()->palette());
 
         int contrast_ = KGlobalSettings::contrast();
         int highlightVal = 100 + (2*contrast_+4)*16/10;
Index: rendering/render_html.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_html.cpp,v
retrieving revision 1.24
diff -b -u -p -r1.24 render_html.cpp
--- rendering/render_html.cpp	2002/01/14 19:56:45	1.24
+++ rendering/render_html.cpp	2002/09/28 15:09:46
@@ -26,6 +26,9 @@
 
 #include "khtmlview.h"
 
+#include <kglobal.h>
+#include <kapplication.h>
+#include <kconfig.h>
 #include <kdebug.h>
 
 using namespace khtml;
@@ -68,7 +71,7 @@ void RenderHtml::printBoxDecorations(QPa
 	if( !bg )
 	    bg = firstChild()->style()->backgroundImage();
         if( !c.isValid() && root()->view())
-            c = root()->view()->palette().active().color(QColorGroup::Base);
+        c = root()->view()->viewport()->palette().active().color(QColorGroup::Base);
     }
 
     int w = width();


More information about the kfm-devel mailing list