Bug 79288 - [Windows, WinCairo] Handle indeterminate state for checkbox in Windows Theme
Summary: [Windows, WinCairo] Handle indeterminate state for checkbox in Windows Theme
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-22 15:45 PST by Lynn Neir
Modified: 2012-02-24 06:46 PST (History)
4 users (show)

See Also:


Attachments
Correct handling of CheckBox when in indeterminate state (1.22 KB, patch)
2012-02-23 16:40 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lynn Neir 2012-02-22 15:45:50 PST
Windows theme code is not handling indeterminate state for CheckBox.  Below is additional code that gives indetermine state capability.  Only change is addition of two lines to check for indeterminate state on checkbox and add 8 to the result.

This gives correct rendering for Layout test: fast/forms/indeterminate.html

unsigned RenderThemeWin::determineState(RenderObject* o)
{
    unsigned result = TS_NORMAL;
    ControlPart appearance = o->style()->appearance();
    if (!isEnabled(o))
        result = TS_DISABLED;
    else if (isReadOnlyControl(o) && (TextFieldPart == appearance || TextAreaPart == appearance || SearchFieldPart == appearance))
        result = TFS_READONLY; // Readonly is supported on textfields.
    else if (isPressed(o)) // Active overrides hover and focused.
        result = TS_ACTIVE;
    else if (supportsFocus(appearance) && isFocused(o))
        result = TS_FOCUSED;
    else if (isHovered(o))
        result = TS_HOVER;

    if (isChecked(o))
        result += 4; // 4 unchecked states, 4 checked states.
    else if (isIndeterminate(o) && appearance == CheckboxPart)
        result += 8;

    return result;
}
Comment 1 Brent Fulgham 2012-02-23 16:40:56 PST
Created attachment 128600 [details]
Correct handling of CheckBox when in indeterminate state

Thanks for the update, Lynn.  I've generated a patch based on your suggested change.
Comment 2 Adam Roben (:aroben) 2012-02-24 05:51:12 PST
Comment on attachment 128600 [details]
Correct handling of CheckBox when in indeterminate state

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

> Source/WebCore/ChangeLog:8
> +        Tested by fast/forms/indeterminate.html

I wish we our regression tests actually tested RenderThemeWin! Then we could check in new pixel results for this test.
Comment 3 WebKit Review Bot 2012-02-24 06:46:04 PST
Comment on attachment 128600 [details]
Correct handling of CheckBox when in indeterminate state

Clearing flags on attachment: 128600

Committed r108791: <http://trac.webkit.org/changeset/108791>
Comment 4 WebKit Review Bot 2012-02-24 06:46:08 PST
All reviewed patches have been landed.  Closing bug.