Bug 75860 - [Chromium Mac] no background is drawn for input elements
Summary: [Chromium Mac] no background is drawn for input elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.6
: P1 Normal
Assignee: Beth Dakin
URL: data:text/html;charset=utf-8,<input s...
Keywords:
: 75742 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-09 08:32 PST by Cary Clark
Modified: 2012-01-09 17:08 PST (History)
9 users (show)

See Also:


Attachments
patch (2.55 KB, patch)
2012-01-09 10:55 PST, Avi Drissman
dglazkov: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cary Clark 2012-01-09 08:32:53 PST
This change: https://bugs.webkit.org/show_bug.cgi?id=75654
breaks <input> elements on Chromium on Mac (all versions).
It is broken when using either CoreGraphics or Skia as the graphics engine.

The break appears to be connected to these lines in RenderThemeMac.mm (2111)

        // Setting a clear background on the cell is necessary for CSS-styled backgrounds
        // to show through. Ideally, there would be a better way to do this.
        [m_textField.get() setDrawsBackground:YES];
        [m_textField.get() setBackgroundColor:[NSColor clearColor]];

Locally changing these to:

        [m_textField.get() setDrawsBackground:NO];
        [m_textField.get() setBackgroundColor:[NSColor whiteColor]];

while incorrect, causes <input> to work (albeit hard-coded to a background of white)
Comment 1 Dimitri Glazkov (Google) 2012-01-09 08:52:35 PST
I checked, Safari port is not affected. Chromium bug here: code.google.com/p/chromium/issues/detail?id=109567
Comment 2 Avi Drissman 2012-01-09 09:35:41 PST
Cary: I agree with your analysis. I'm curious about the comment re "CSS-styled backgrounds", as this implies a different painting model than us. We're just redrawing the control; does Safari do a full back-to-front repaint?

Dmitri: "Safari port is not affected": Does the Safari port use RenderThemeMac, or RenderThemeSafari? (BTW, when is RenderThemeSafari used?)
Comment 3 Avi Drissman 2012-01-09 09:45:51 PST
We always have the short-term option of overriding paintTextField in RenderThemeChromiumMac and doing it our way if we can't figure out what's going on.

BTW, WKDrawBezeledTextFieldCell is just a wrapper over _NSDrawCarbonThemeBezel, so it's not crystal clear what the old behavior was.
Comment 4 Dimitri Glazkov (Google) 2012-01-09 09:50:55 PST
(In reply to comment #2)
> Cary: I agree with your analysis. I'm curious about the comment re "CSS-styled backgrounds", as this implies a different painting model than us. We're just redrawing the control; does Safari do a full back-to-front repaint?
> 
> Dmitri: "Safari port is not affected": Does the Safari port use RenderThemeMac, or RenderThemeSafari? (BTW, when is RenderThemeSafari used?)

RenderThemeMac -> Safari Mac
RenderThemeSafari -> Safari Windows
Comment 5 Nico Weber 2012-01-09 10:00:54 PST
Bug 75742 was caused by this revision as well.
Comment 6 Dimitri Glazkov (Google) 2012-01-09 10:10:51 PST
(In reply to comment #3)
> We always have the short-term option of overriding paintTextField in RenderThemeChromiumMac and doing it our way if we can't figure out what's going on.
> 
> BTW, WKDrawBezeledTextFieldCell is just a wrapper over _NSDrawCarbonThemeBezel, so it's not crystal clear what the old behavior was.

+1 on a quick and dirty fix for now.
Comment 7 Nico Weber 2012-01-09 10:26:47 PST
I can't repro this when I build on Lion, with the 10.6 SDK. So this problem might be triggered by us using the 10.5 sdk (which we have to, since we ship on 10.5).
Comment 8 Avi Drissman 2012-01-09 10:32:45 PST
(In reply to comment #7)
> So this problem might be triggered by us using the 10.5 sdk (which we have to, since we ship on 10.5).

Oh joy, one of those "let's change the behavior of an API call depending on what version you linked". It's reproducible for me with the 10.5 SDK.

I'm OK with overriding as a QND fix, but the question is now what to override it with. It would suck if we had to use the SPI again. I'm playing around with explicitly filling the background.
Comment 9 Avi Drissman 2012-01-09 10:55:27 PST
Created attachment 121690 [details]
patch

Sigh. This does work, and I'd be OK with it for a quick-n-dirty fix. In the long run, what to do? If the official Cocoa code works with the 10.6 SDK, do we just let this go until that's our minimum?

(BTW, this patch is off my Git checkout with some massaging. I hope the CQ can cope.)
Comment 10 WebKit Review Bot 2012-01-09 11:01:33 PST
Attachment 121690 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files']" exit_code: 1

Total errors found: 0 in 0 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Nico Weber 2012-01-09 11:02:56 PST
Comment on attachment 121690 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=121690&action=review

Looks fine. Can you check if this fixes fast/forms/input-disabled-color.html (the bug I linked to above) too?

> Source/WebCore/rendering/RenderThemeChromiumMac.h:36
> +    virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);

OVERRIDE? :-)
Comment 12 Nico Weber 2012-01-09 11:26:10 PST
*** Bug 75742 has been marked as a duplicate of this bug. ***
Comment 13 Avi Drissman 2012-01-09 11:28:23 PST
(In reply to comment #11)
> Looks fine. Can you check if this fixes fast/forms/input-disabled-color.html (the bug I linked to above) too?

That was my test to see if it was a functional patch. So yes.

> OVERRIDE? :-)

I don't consider this code as Chromium code for the purposes of the style guide.
Comment 14 Avi Drissman 2012-01-09 11:45:28 PST
We might as well leave this fix in until we drop 10.5 support. Poking around the guts of NSTextFieldCell doesn't sound very fun, and since this is apparently fixed with the 10.6 SDK it can join the cruft-we-keep-around-for-Leopard party.
Comment 15 WebKit Review Bot 2012-01-09 13:21:57 PST
Comment on attachment 121690 [details]
patch

Rejecting attachment 121690 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
t/git/webkit-commit-queue/Source/WebKit/chromium/v8 --revision 10314 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
46>At revision 10314.

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/11184655
Comment 16 Adam Barth 2012-01-09 13:23:38 PST
Found no modified ChangeLogs, cannot create a commit message.
Comment 17 Adam Barth 2012-01-09 13:24:32 PST
Comment on attachment 121690 [details]
patch

Strange.  The patch does seem to have a ChangeLog.  The style-queue has similar problems.  Maybe we should land this manually.
Comment 18 Avi Drissman 2012-01-09 13:25:16 PST
(In reply to comment #17)
> (From update of attachment 121690 [details])
> Strange.  The patch does seem to have a ChangeLog.  The style-queue has similar problems.  Maybe we should land this manually.

This was a diff from my git repro. Let me recreate it in a real svn repo and repost.
Comment 19 Adam Barth 2012-01-09 15:13:06 PST
Committed r104494: <http://trac.webkit.org/changeset/104494>
Comment 20 Avi Drissman 2012-01-09 16:52:35 PST
(In reply to comment #19)
> Committed r104494: <http://trac.webkit.org/changeset/104494>

Thanks! I had to go, and my WebKit checkout was so old that svn up was still cranking after half an hour.
Comment 21 Adam Barth 2012-01-09 17:08:11 PST
No problem.  The issue was just that the patch was incorrectly based.  We use -p1 but the patch was using -p0.