Bug 116804 - HTML Form Controls Rendered as if they are disabled in QT5 with Windows Vista application Style
Summary: HTML Form Controls Rendered as if they are disabled in QT5 with Windows Vista...
Status: RESOLVED DUPLICATE of bug 112688
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Major
Assignee: Simon Hausmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-26 21:21 PDT by Stephen
Modified: 2013-07-09 01:17 PDT (History)
4 users (show)

See Also:


Attachments
Test page (1.56 KB, text/html)
2013-05-26 21:21 PDT, Stephen
no flags Details
Screenshot (21.31 KB, image/jpeg)
2013-05-26 21:23 PDT, Stephen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen 2013-05-26 21:21:33 PDT
Created attachment 202947 [details]
Test page

In QT5, when the defualt Windows vista application style is used, basically all the html controls (text inputs, text areas, check boxes, radio buttons, drop down selects, etc) are rendered as if they are in a disabled state. 

I've attached a test html page and a screenshot.
Comment 1 Stephen 2013-05-26 21:23:58 PDT
Created attachment 202949 [details]
Screenshot
Comment 2 Stephen 2013-05-28 17:29:40 PDT
After some digging, I found the cause of the problem inside the file RenderThemeQStyle.cpp near the following code:

ControlPart RenderThemeQStyle::initializeCommonQStyleOptions(QStyleFacadeOption &option, RenderObject* o) const
{
    // Default bits: no focus, no mouse over
    option.state &= ~(QStyleFacade::State_HasFocus | QStyleFacade::State_MouseOver);

    if (isReadOnlyControl(o))
        // Readonly is supported on textfields.
        option.state |= QStyleFacade::State_ReadOnly;

    option.direction = Qt::LeftToRight;

    if (isHovered(o))
        option.state |= QStyleFacade::State_MouseOver;

    setPaletteFromPageClientIfExists(option.palette);

    if (!isEnabled(o)) {
        option.palette.setCurrentColorGroup(QPalette::Disabled);
        option.state &= ~QStyleFacade::State_Enabled;
    }
...
}

During the initialization of the style options, the State_Enabled bit is removed if the control is disabled. However, in the constructor of the option, the state is initialized as State_None, which means disabled. We need either initialize the state as State_Enabled or add a "else" clause after the last "if" as shown below:

    if (!isEnabled(o)) {
        option.palette.setCurrentColorGroup(QPalette::Disabled);
        option.state &= ~QStyleFacade::State_Enabled;
    }
    else
    {
        option.state |= QStyleFacade::State_Enabled;
    }
Comment 3 Stephen 2013-07-08 19:04:05 PDT
This still exists in QT 5.1.
Comment 4 Simon Hausmann 2013-07-09 00:39:43 PDT
That looks rather plausible and is probably a regression I introduced. Looking into it. Great analysis, btw!
Comment 5 Simon Hausmann 2013-07-09 01:17:02 PDT

*** This bug has been marked as a duplicate of bug 112688 ***