Changeset 183378 in webkit


Ignore:
Timestamp:
Apr 26, 2015, 7:04:11 PM (10 years ago)
Author:
Darin Adler
Message:

REGRESSION (r174283): disabled default buttons use impossible-to-read white text on Mac
https://bugs.webkit.org/show_bug.cgi?id=144237

Reviewed by Simon Fraser.

No test because DumpRenderTree and WebKitTestRunner don't have a good method
for testing behaviors that are specific to active windows. That's the same reason
that the change that caused this bug didn't come with a regression test.

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::adjustStyle): Renamed "e" to "element". Added a comment to
clarify the meaning of the setInsideDefaultButton function, and added an
isDisabledFormControl check so it won't trigger on a disabled button.
(WebCore::RenderTheme::systemColor): Moved CSSValueActivebuttontext into
alphabetical order to match the rest of the switch statement ordering.

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::systemColor): Moved CSSValueActivebuttontext into
alphabetical order to match the rest of the switch statement ordering. Also
fixed its behavior on older versions of OS X; it should just return the same
thing that CSSValueButtontext would return in that context.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r183373 r183378  
     12015-04-26  Darin Adler  <darin@apple.com>
     2
     3        REGRESSION (r174283): disabled default buttons use impossible-to-read white text on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=144237
     5
     6        Reviewed by Simon Fraser.
     7
     8        No test because DumpRenderTree and WebKitTestRunner don't have a good method
     9        for testing behaviors that are specific to active windows. That's the same reason
     10        that the change that caused this bug didn't come with a regression test.
     11
     12        * rendering/RenderTheme.cpp:
     13        (WebCore::RenderTheme::adjustStyle): Renamed "e" to "element". Added a comment to
     14        clarify the meaning of the setInsideDefaultButton function, and added an
     15        isDisabledFormControl check so it won't trigger on a disabled button.
     16        (WebCore::RenderTheme::systemColor): Moved CSSValueActivebuttontext into
     17        alphabetical order to match the rest of the switch statement ordering.
     18
     19        * rendering/RenderThemeMac.mm:
     20        (WebCore::RenderThemeMac::systemColor): Moved CSSValueActivebuttontext into
     21        alphabetical order to match the rest of the switch statement ordering. Also
     22        fixed its behavior on older versions of OS X; it should just return the same
     23        thing that CSSValueButtontext would return in that context.
     24
    1252015-04-26  Yusuke Suzuki  <utatane.tea@gmail.com>
    226
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r183366 r183378  
    8080}
    8181
    82 void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style, Element* e, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
     82void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style, Element* element, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
    8383{
    8484    // Force inline and table display styles to be inline-block (except for table- which is block)
     
    177177                style.fontCascade().update(nullptr);
    178178        }
    179         style.setInsideDefaultButton(part == DefaultButtonPart);
    180     }
    181     break;
     179
     180        // Special style that tells enabled default buttons in active windows to use the ActiveButtonText color.
     181        // The active window part of the test has to be done at paint time since it's not triggered by a style change.
     182        style.setInsideDefaultButton(part == DefaultButtonPart && element && !element->isDisabledFormControl());
     183        break;
     184    }
    182185    default:
    183186        break;
     
    189192#if !USE(NEW_THEME)
    190193    case CheckboxPart:
    191         return adjustCheckboxStyle(styleResolver, style, e);
     194        return adjustCheckboxStyle(styleResolver, style, element);
    192195    case RadioPart:
    193         return adjustRadioStyle(styleResolver, style, e);
     196        return adjustRadioStyle(styleResolver, style, element);
    194197    case PushButtonPart:
    195198    case SquareButtonPart:
    196199    case DefaultButtonPart:
    197200    case ButtonPart:
    198         return adjustButtonStyle(styleResolver, style, e);
     201        return adjustButtonStyle(styleResolver, style, element);
    199202    case InnerSpinButtonPart:
    200         return adjustInnerSpinButtonStyle(styleResolver, style, e);
     203        return adjustInnerSpinButtonStyle(styleResolver, style, element);
    201204#endif
    202205    case TextFieldPart:
    203         return adjustTextFieldStyle(styleResolver, style, e);
     206        return adjustTextFieldStyle(styleResolver, style, element);
    204207    case TextAreaPart:
    205         return adjustTextAreaStyle(styleResolver, style, e);
     208        return adjustTextAreaStyle(styleResolver, style, element);
    206209    case MenulistPart:
    207         return adjustMenuListStyle(styleResolver, style, e);
     210        return adjustMenuListStyle(styleResolver, style, element);
    208211    case MenulistButtonPart:
    209         return adjustMenuListButtonStyle(styleResolver, style, e);
     212        return adjustMenuListButtonStyle(styleResolver, style, element);
    210213    case MediaPlayButtonPart:
    211214    case MediaCurrentTimePart:
     
    215218    case MediaMuteButtonPart:
    216219    case MediaVolumeSliderContainerPart:
    217         return adjustMediaControlStyle(styleResolver, style, e);
     220        return adjustMediaControlStyle(styleResolver, style, element);
    218221    case MediaSliderPart:
    219222    case MediaVolumeSliderPart:
     
    221224    case SliderHorizontalPart:
    222225    case SliderVerticalPart:
    223         return adjustSliderTrackStyle(styleResolver, style, e);
     226        return adjustSliderTrackStyle(styleResolver, style, element);
    224227    case SliderThumbHorizontalPart:
    225228    case SliderThumbVerticalPart:
    226         return adjustSliderThumbStyle(styleResolver, style, e);
     229        return adjustSliderThumbStyle(styleResolver, style, element);
    227230    case SearchFieldPart:
    228         return adjustSearchFieldStyle(styleResolver, style, e);
     231        return adjustSearchFieldStyle(styleResolver, style, element);
    229232    case SearchFieldCancelButtonPart:
    230         return adjustSearchFieldCancelButtonStyle(styleResolver, style, e);
     233        return adjustSearchFieldCancelButtonStyle(styleResolver, style, element);
    231234    case SearchFieldDecorationPart:
    232         return adjustSearchFieldDecorationPartStyle(styleResolver, style, e);
     235        return adjustSearchFieldDecorationPartStyle(styleResolver, style, element);
    233236    case SearchFieldResultsDecorationPart:
    234         return adjustSearchFieldResultsDecorationPartStyle(styleResolver, style, e);
     237        return adjustSearchFieldResultsDecorationPartStyle(styleResolver, style, element);
    235238    case SearchFieldResultsButtonPart:
    236         return adjustSearchFieldResultsButtonStyle(styleResolver, style, e);
     239        return adjustSearchFieldResultsButtonStyle(styleResolver, style, element);
    237240    case ProgressBarPart:
    238         return adjustProgressBarStyle(styleResolver, style, e);
     241        return adjustProgressBarStyle(styleResolver, style, element);
    239242#if ENABLE(METER_ELEMENT)
    240243    case MeterPart:
     
    243246    case DiscreteCapacityLevelIndicatorPart:
    244247    case RatingLevelIndicatorPart:
    245         return adjustMeterStyle(styleResolver, style, e);
     248        return adjustMeterStyle(styleResolver, style, element);
    246249#endif
    247250#if ENABLE(SERVICE_CONTROLS)
     
    250253#endif
    251254    case CapsLockIndicatorPart:
    252         return adjustCapsLockIndicatorStyle(styleResolver, style, e);
     255        return adjustCapsLockIndicatorStyle(styleResolver, style, element);
    253256#if ENABLE(ATTACHMENT_ELEMENT)
    254257    case AttachmentPart:
    255         return adjustAttachmentStyle(styleResolver, style, e);
     258        return adjustAttachmentStyle(styleResolver, style, element);
    256259#endif
    257260    default:
     
    12211224    case CSSValueActiveborder:
    12221225        return 0xFFFFFFFF;
     1226    case CSSValueActivebuttontext:
     1227        return 0xFF000000;
    12231228    case CSSValueActivecaption:
    12241229        return 0xFFCCCCCC;
     
    12341239        return 0xFF888888;
    12351240    case CSSValueButtontext:
    1236         return 0xFF000000;
    1237     case CSSValueActivebuttontext:
    12381241        return 0xFF000000;
    12391242    case CSSValueCaptiontext:
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r181934 r183378  
    468468        color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]);
    469469        break;
     470    case CSSValueActivebuttontext:
     471#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     472        // There is no corresponding NSColor for this so we use a hard coded value.
     473        color = 0xC0FFFFFF;
     474#else
     475        color = convertNSColorToColor([NSColor controlTextColor]);
     476#endif
     477        break;
    470478    case CSSValueActivecaption:
    471479        color = convertNSColorToColor([NSColor windowFrameTextColor]);
     
    490498    case CSSValueButtontext:
    491499        color = convertNSColorToColor([NSColor controlTextColor]);
    492         break;
    493     case CSSValueActivebuttontext:
    494 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
    495         color = 0xC0FFFFFF;
    496 #endif
    497500        break;
    498501    case CSSValueCaptiontext:
Note: See TracChangeset for help on using the changeset viewer.