Bug 37779 - [GTK] Button and Entry font color doesn't respect the system's style
Summary: [GTK] Button and Entry font color doesn't respect the system's style
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-18 15:49 PDT by Olivier Tilloy
Modified: 2010-05-31 09:04 PDT (History)
7 users (show)

See Also:


Attachments
A screenshot of the issue (76.99 KB, image/png)
2010-04-18 15:49 PDT, Olivier Tilloy
no flags Details
A preliminary patch (1.93 KB, patch)
2010-04-19 02:27 PDT, Olivier Tilloy
no flags Details | Formatted Diff | Diff
A preliminary patch (1.91 KB, patch)
2010-04-19 02:31 PDT, Olivier Tilloy
no flags Details | Formatted Diff | Diff
A complete patch (4.86 KB, patch)
2010-04-22 09:34 PDT, Olivier Tilloy
no flags Details | Formatted Diff | Diff
Split patch - GTK specific changes only (4.01 KB, patch)
2010-05-31 07:46 PDT, Olivier Tilloy
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Tilloy 2010-04-18 15:49:40 PDT
Created attachment 53640 [details]
A screenshot of the issue

This bug is the GTK-specific counterpart of bug #35024.

This is particularly visible with a dark theme such as Nodoka-Midnight. The text color of buttons and text entries in forms doesn't respect the system's style. In Nodoka-Midnight, the text color for buttons is very light in contrast with the background color which is very dark. However in WebKitGTK the labels of buttons are rendered using the default color (defined by RenderTheme::systemColor), which is black (CSSValueButtontext), resulting in unreadable buttons. The same applies to text entries, although the code path may be different.

The attached screenshot should be quite self-explanatory.
Comment 1 Olivier Tilloy 2010-04-18 15:51:56 PDT
In fact it also looks like the background color of buttons and text entries is incorrect vs the system's style.
Comment 2 Olivier Tilloy 2010-04-19 02:27:20 PDT
Created attachment 53663 [details]
A preliminary patch

This is a preliminary patch that fixes the font color of buttons.
Unfortunately I could figure out how to extend the patch to text inputs and areas, it looks like the code path is quite different. Any input/feedback is welcome.

Please note that this patch breaks at least one layout test (fast/forms/button-style-color.html). This is because the expected layout hard codes the colors of the buttons, which is obviously going to break if such colors depend on the current GTK style.
Comment 3 WebKit Review Bot 2010-04-19 02:28:47 PDT
Attachment 53663 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/platform/gtk/RenderThemeGtk.cpp:590:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Olivier Tilloy 2010-04-19 02:31:28 PDT
Created attachment 53664 [details]
A preliminary patch

Updated patch to fix coding style issues.
Comment 5 Olivier Tilloy 2010-04-22 09:34:30 PDT
Created attachment 54065 [details]
A complete patch

This is an updated patch that fixes the issue for all input widgets.
Please note that it predictably breaks the following layouts tests which will need to be adapted or skipped:

  editing/selection/select-box.html
  fast/css/text-input-with-webkit-border-radius.html
  fast/forms/button-style-color.html

Known limitation: when the theme is changed on the fly, the text of the input widgets is not re-rendered, so the font color is wrong. This is not a regression though, it was already the case. Either the functionality to trigger a re-rendering is missing in webkit itself, or I couldn't locate it. For comparison, firefox does re-render.

Comments welcome!
Comment 6 Gustavo Noronha (kov) 2010-04-22 10:33:41 PDT
Comment on attachment 54065 [details]
A complete patch

In general the change looks good to me, but the change to html.css makes me nervous, since it is likely used for all platforms, and we don't want to change their behaviour. Let's try to get someone who knows about that to look at the change.
Comment 7 Gustavo Noronha (kov) 2010-04-22 10:34:57 PDT
I think Hyatt could lend us a hand regarding the CSS change? =)
Comment 8 Olivier Tilloy 2010-04-23 00:18:55 PDT
Indeed the patch likely impacts all the other ports, and depending on the expected outputs possibly breaks the same layout tests I mentioned for them as well.

However the changes to html.css are consistent with what was already there:
the color for buttons was set to "ButtonText" (which ensures platform-specific theming) in contrast with text input for which it was set to "initial". And the text color for dropdown lists (select and keygen) was hard-coded to "black", which doesn't seem right.

I suppose the layout tests could be adapted by styling the input elements to ensure the resulting color are independent from the platform.
Comment 9 Olivier Tilloy 2010-05-17 14:55:50 PDT
Dave commented that the patch looks fine, we now need to check with the Chromium team that the change is ok there too:

  [dhyatt] change looks fine to me, but i'd check with chromium guys too
  [dhyatt] make sure CaptionText is right for their platform
Comment 10 Shinichiro Hamaji 2010-05-31 04:31:44 PDT
Looks like windows chromium only uses RenderTheme::systemColor().  RenderThemeChromiumWin::systemColor() uses GetSystemColor(COLOR_CAPTIONTEXT) as the color value for CaptionText. I don't know if this color is black. I've sent a try job to check this, but it seems the trybot is unhealthy for now (http://build.chromium.org/buildbot/try-server/builders/layout_win/builds/1898). Windows port seems to be using the same color, so this patch would be OK if this patch doesn't change the results of win safari.

CCing pkasting (the guy who wrote RenderThemeChromiumWin::systemColor).

By the way, I want you to remove [GTK] from the ChangeLog description (or please mention that we are changing the behavior of GTK, Win, and Chromium win). Otherwise, someone will miss this change when she/he is investigating the history.
Comment 11 Shinichiro Hamaji 2010-05-31 05:19:36 PDT
It seems many tests are failing

http://build.chromium.org/buildbot/try-server/builders/layout_win/builds/1900

I guess these tests will fail with Win Safari. I think there are three ways now:

1. ask chromium-win and win safari people if this UI change is OK
2. modify themeWin.css to cancel this change for chromium-win and win safari
3. add themeGtk.css and makes this change affect only gtk for now

Personally, I think this change is aiming a good direction and the choice 1 would be the best, but maybe making a consensus might be a bit more difficult than other two options.
Comment 12 Shinichiro Hamaji 2010-05-31 05:32:39 PDT
FYI, all tests passed on linux chromium and mac chromium, unsurprisingly.

http://build.chromium.org/buildbot/try-server/builders/layout_linux/builds/1892
http://build.chromium.org/buildbot/try-server/builders/layout_mac/builds/1698
Comment 13 Olivier Tilloy 2010-05-31 05:58:51 PDT
As discussed with Hamaji, I'm going to split this patch into two, one with the GTK specific changes, and another one with the changes to the default CSS, which I will attach to a new bug report for discussion and in-depth review by relevant people from the various ports.
Comment 14 Olivier Tilloy 2010-05-31 07:46:36 PDT
Created attachment 57464 [details]
Split patch - GTK specific changes only

As commented above, this updated patch contains only the GTK specific changes, it should be easier to merge in a first step.
I verified that it doesn't break any existing layout test.
Note that because changes to the default CSS are needed, it only partially fixes the bug: the foreground color for buttons is now correct, but that of text entries isn't.
Comment 15 Olivier Tilloy 2010-05-31 08:24:06 PDT
I filed bug #39956 to discuss and review the changes to the default CSS.
Comment 16 Gustavo Noronha (kov) 2010-05-31 08:30:21 PDT
Comment on attachment 57464 [details]
Split patch - GTK specific changes only

Looks sane to me.
Comment 17 WebKit Commit Bot 2010-05-31 09:04:39 PDT
Comment on attachment 57464 [details]
Split patch - GTK specific changes only

Clearing flags on attachment: 57464

Committed r60440: <http://trac.webkit.org/changeset/60440>
Comment 18 WebKit Commit Bot 2010-05-31 09:04:47 PDT
All reviewed patches have been landed.  Closing bug.