[webkit-dev] small change to RenderThemeWin::determineState

Lynn Neir lynn.neir at skype.net
Wed Feb 22 15:20:32 PST 2012

Hello... I have a small addition to RenderThemeWin::determineState so it will handle indeterminate (mixed) state for checkbox.  I am not sure who owns this code.

Below is the new code.   The addition are the two lines to check for indeterminate state on CheckboxPart.

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;

Lynn Neir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120222/50a90267/attachment.html>

More information about the webkit-dev mailing list