Changeset 142071 in webkit


Ignore:
Timestamp:
Feb 7, 2013 12:25:26 AM (11 years ago)
Author:
tkent@chromium.org
Message:

Fix style of RenderTheme.cpp and RenderThemeChromiumWin.h
https://bugs.webkit.org/show_bug.cgi?id=109137

Reviewed by Kentaro Hara.

No new tests. Just style fix.

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::paintBorderOnly):
(WebCore::RenderTheme::paintDecorations):
(WebCore::RenderTheme::isControlStyled):
(WebCore::RenderTheme::adjustButtonStyle):
(WebCore::RenderTheme::systemColor):

  • rendering/RenderThemeChromiumWin.h:

(WebCore::ThemeData::ThemeData):
(ThemeData):
(RenderThemeChromiumWin):
(WebCore::RenderThemeChromiumWin::RenderThemeChromiumWin):
(WebCore::RenderThemeChromiumWin::~RenderThemeChromiumWin):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r142069 r142071  
     12013-02-06  Kent Tamura  <tkent@chromium.org>
     2
     3        Fix style of RenderTheme.cpp and RenderThemeChromiumWin.h
     4        https://bugs.webkit.org/show_bug.cgi?id=109137
     5
     6        Reviewed by Kentaro Hara.
     7
     8        No new tests. Just style fix.
     9
     10        * rendering/RenderTheme.cpp:
     11        (WebCore::RenderTheme::adjustStyle):
     12        (WebCore::RenderTheme::paint):
     13        (WebCore::RenderTheme::paintBorderOnly):
     14        (WebCore::RenderTheme::paintDecorations):
     15        (WebCore::RenderTheme::isControlStyled):
     16        (WebCore::RenderTheme::adjustButtonStyle):
     17        (WebCore::RenderTheme::systemColor):
     18        * rendering/RenderThemeChromiumWin.h:
     19        (WebCore::ThemeData::ThemeData):
     20        (ThemeData):
     21        (RenderThemeChromiumWin):
     22        (WebCore::RenderThemeChromiumWin::RenderThemeChromiumWin):
     23        (WebCore::RenderThemeChromiumWin::~RenderThemeChromiumWin):
     24
    1252013-02-06  Kent Tamura  <tkent@chromium.org>
    226
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r140778 r142071  
    8282}
    8383
    84 void RenderTheme::adjustStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e,
    85                               bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
     84void RenderTheme::adjustStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
    8685{
    8786    // Force inline and table display styles to be inline-block (except for table- which is block)
    8887    ControlPart part = style->appearance();
    89     if (style->display() == INLINE || style->display() == INLINE_TABLE || style->display() == TABLE_ROW_GROUP ||
    90         style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_FOOTER_GROUP ||
    91         style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_COLUMN ||
    92         style->display() == TABLE_CELL || style->display() == TABLE_CAPTION)
     88    if (style->display() == INLINE || style->display() == INLINE_TABLE || style->display() == TABLE_ROW_GROUP
     89        || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_FOOTER_GROUP
     90        || style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_COLUMN
     91        || style->display() == TABLE_CELL || style->display() == TABLE_CAPTION)
    9392        style->setDisplay(INLINE_BLOCK);
    9493    else if (style->display() == COMPACT || style->display() == RUN_IN || style->display() == LIST_ITEM || style->display() == TABLE)
     
    111110#if USE(NEW_THEME)
    112111    switch (part) {
    113         case CheckboxPart:
    114         case InnerSpinButtonPart:
    115         case RadioPart:
    116         case PushButtonPart:
    117         case SquareButtonPart:
    118         case DefaultButtonPart:
    119         case ButtonPart: {
    120             // Border
    121             LengthBox borderBox(style->borderTopWidth(), style->borderRightWidth(), style->borderBottomWidth(), style->borderLeftWidth());
    122             borderBox = m_theme->controlBorder(part, style->font(), borderBox, style->effectiveZoom());
    123             if (borderBox.top().value() != static_cast<int>(style->borderTopWidth())) {
    124                 if (borderBox.top().value())
    125                     style->setBorderTopWidth(borderBox.top().value());
    126                 else
    127                     style->resetBorderTop();
    128             }
    129             if (borderBox.right().value() != static_cast<int>(style->borderRightWidth())) {
    130                 if (borderBox.right().value())
    131                     style->setBorderRightWidth(borderBox.right().value());
    132                 else
    133                     style->resetBorderRight();
    134             }
    135             if (borderBox.bottom().value() != static_cast<int>(style->borderBottomWidth())) {
     112    case CheckboxPart:
     113    case InnerSpinButtonPart:
     114    case RadioPart:
     115    case PushButtonPart:
     116    case SquareButtonPart:
     117    case DefaultButtonPart:
     118    case ButtonPart: {
     119        // Border
     120        LengthBox borderBox(style->borderTopWidth(), style->borderRightWidth(), style->borderBottomWidth(), style->borderLeftWidth());
     121        borderBox = m_theme->controlBorder(part, style->font(), borderBox, style->effectiveZoom());
     122        if (borderBox.top().value() != static_cast<int>(style->borderTopWidth())) {
     123            if (borderBox.top().value())
     124                style->setBorderTopWidth(borderBox.top().value());
     125            else
     126                style->resetBorderTop();
     127        }
     128        if (borderBox.right().value() != static_cast<int>(style->borderRightWidth())) {
     129            if (borderBox.right().value())
     130                style->setBorderRightWidth(borderBox.right().value());
     131            else
     132                style->resetBorderRight();
     133        }
     134        if (borderBox.bottom().value() != static_cast<int>(style->borderBottomWidth())) {
     135            style->setBorderBottomWidth(borderBox.bottom().value());
     136            if (borderBox.bottom().value())
    136137                style->setBorderBottomWidth(borderBox.bottom().value());
    137                 if (borderBox.bottom().value())
    138                     style->setBorderBottomWidth(borderBox.bottom().value());
    139                 else
    140                     style->resetBorderBottom();
    141             }
    142             if (borderBox.left().value() != static_cast<int>(style->borderLeftWidth())) {
     138            else
     139                style->resetBorderBottom();
     140        }
     141        if (borderBox.left().value() != static_cast<int>(style->borderLeftWidth())) {
     142            style->setBorderLeftWidth(borderBox.left().value());
     143            if (borderBox.left().value())
    143144                style->setBorderLeftWidth(borderBox.left().value());
    144                 if (borderBox.left().value())
    145                     style->setBorderLeftWidth(borderBox.left().value());
    146                 else
    147                     style->resetBorderLeft();
    148             }
    149 
    150             // Padding
    151             LengthBox paddingBox = m_theme->controlPadding(part, style->font(), style->paddingBox(), style->effectiveZoom());
    152             if (paddingBox != style->paddingBox())
    153                 style->setPaddingBox(paddingBox);
    154 
    155             // Whitespace
    156             if (m_theme->controlRequiresPreWhiteSpace(part))
    157                 style->setWhiteSpace(PRE);
     145            else
     146                style->resetBorderLeft();
     147        }
     148
     149        // Padding
     150        LengthBox paddingBox = m_theme->controlPadding(part, style->font(), style->paddingBox(), style->effectiveZoom());
     151        if (paddingBox != style->paddingBox())
     152            style->setPaddingBox(paddingBox);
     153
     154        // Whitespace
     155        if (m_theme->controlRequiresPreWhiteSpace(part))
     156            style->setWhiteSpace(PRE);
    158157           
    159             // Width / Height
    160             // The width and height here are affected by the zoom.
    161             // FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
    162             LengthSize controlSize = m_theme->controlSize(part, style->font(), LengthSize(style->width(), style->height()), style->effectiveZoom());
    163             if (controlSize.width() != style->width())
    164                 style->setWidth(controlSize.width());
    165             if (controlSize.height() != style->height())
    166                 style->setHeight(controlSize.height());
     158        // Width / Height
     159        // The width and height here are affected by the zoom.
     160        // FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
     161        LengthSize controlSize = m_theme->controlSize(part, style->font(), LengthSize(style->width(), style->height()), style->effectiveZoom());
     162        if (controlSize.width() != style->width())
     163            style->setWidth(controlSize.width());
     164        if (controlSize.height() != style->height())
     165            style->setHeight(controlSize.height());
    167166               
    168             // Min-Width / Min-Height
    169             LengthSize minControlSize = m_theme->minimumControlSize(part, style->font(), style->effectiveZoom());
    170             if (minControlSize.width() != style->minWidth())
    171                 style->setMinWidth(minControlSize.width());
    172             if (minControlSize.height() != style->minHeight())
    173                 style->setMinHeight(minControlSize.height());
     167        // Min-Width / Min-Height
     168        LengthSize minControlSize = m_theme->minimumControlSize(part, style->font(), style->effectiveZoom());
     169        if (minControlSize.width() != style->minWidth())
     170            style->setMinWidth(minControlSize.width());
     171        if (minControlSize.height() != style->minHeight())
     172            style->setMinHeight(minControlSize.height());
    174173               
    175             // Font
    176             FontDescription controlFont = m_theme->controlFont(part, style->font(), style->effectiveZoom());
    177             if (controlFont != style->font().fontDescription()) {
    178                 // Reset our line-height
    179                 style->setLineHeight(RenderStyle::initialLineHeight());
    180                
    181                 // Now update our font.
    182                 if (style->setFontDescription(controlFont))
    183                     style->font().update(0);
    184             }
     174        // Font
     175        FontDescription controlFont = m_theme->controlFont(part, style->font(), style->effectiveZoom());
     176        if (controlFont != style->font().fontDescription()) {
     177            // Reset our line-height
     178            style->setLineHeight(RenderStyle::initialLineHeight());
     179
     180            // Now update our font.
     181            if (style->setFontDescription(controlFont))
     182                style->font().update(0);
    185183        }
    186         default:
    187             break;
     184    }
     185    default:
     186        break;
    188187    }
    189188#endif
     
    192191    switch (style->appearance()) {
    193192#if !USE(NEW_THEME)
    194         case CheckboxPart:
    195             return adjustCheckboxStyle(styleResolver, style, e);
    196         case RadioPart:
    197             return adjustRadioStyle(styleResolver, style, e);
    198         case PushButtonPart:
    199         case SquareButtonPart:
    200         case DefaultButtonPart:
    201         case ButtonPart:
    202             return adjustButtonStyle(styleResolver, style, e);
    203         case InnerSpinButtonPart:
    204             return adjustInnerSpinButtonStyle(styleResolver, style, e);
    205 #endif
    206         case TextFieldPart:
    207             return adjustTextFieldStyle(styleResolver, style, e);
    208         case TextAreaPart:
    209             return adjustTextAreaStyle(styleResolver, style, e);
    210         case MenulistPart:
    211             return adjustMenuListStyle(styleResolver, style, e);
    212         case MenulistButtonPart:
    213             return adjustMenuListButtonStyle(styleResolver, style, e);
    214         case MediaPlayButtonPart:
    215         case MediaCurrentTimePart:
    216         case MediaTimeRemainingPart:
    217         case MediaEnterFullscreenButtonPart:
    218         case MediaExitFullscreenButtonPart:
    219         case MediaMuteButtonPart:
    220         case MediaVolumeSliderContainerPart:
    221             return adjustMediaControlStyle(styleResolver, style, e);
    222         case MediaSliderPart:
    223         case MediaVolumeSliderPart:
    224         case MediaFullScreenVolumeSliderPart:
    225         case SliderHorizontalPart:
    226         case SliderVerticalPart:
    227             return adjustSliderTrackStyle(styleResolver, style, e);
    228         case SliderThumbHorizontalPart:
    229         case SliderThumbVerticalPart:
    230             return adjustSliderThumbStyle(styleResolver, style, e);
    231         case SearchFieldPart:
    232             return adjustSearchFieldStyle(styleResolver, style, e);
    233         case SearchFieldCancelButtonPart:
    234             return adjustSearchFieldCancelButtonStyle(styleResolver, style, e);
    235         case SearchFieldDecorationPart:
    236             return adjustSearchFieldDecorationStyle(styleResolver, style, e);
    237         case SearchFieldResultsDecorationPart:
    238             return adjustSearchFieldResultsDecorationStyle(styleResolver, style, e);
    239         case SearchFieldResultsButtonPart:
    240             return adjustSearchFieldResultsButtonStyle(styleResolver, style, e);
     193    case CheckboxPart:
     194        return adjustCheckboxStyle(styleResolver, style, e);
     195    case RadioPart:
     196        return adjustRadioStyle(styleResolver, style, e);
     197    case PushButtonPart:
     198    case SquareButtonPart:
     199    case DefaultButtonPart:
     200    case ButtonPart:
     201        return adjustButtonStyle(styleResolver, style, e);
     202    case InnerSpinButtonPart:
     203        return adjustInnerSpinButtonStyle(styleResolver, style, e);
     204#endif
     205    case TextFieldPart:
     206        return adjustTextFieldStyle(styleResolver, style, e);
     207    case TextAreaPart:
     208        return adjustTextAreaStyle(styleResolver, style, e);
     209    case MenulistPart:
     210        return adjustMenuListStyle(styleResolver, style, e);
     211    case MenulistButtonPart:
     212        return adjustMenuListButtonStyle(styleResolver, style, e);
     213    case MediaPlayButtonPart:
     214    case MediaCurrentTimePart:
     215    case MediaTimeRemainingPart:
     216    case MediaEnterFullscreenButtonPart:
     217    case MediaExitFullscreenButtonPart:
     218    case MediaMuteButtonPart:
     219    case MediaVolumeSliderContainerPart:
     220        return adjustMediaControlStyle(styleResolver, style, e);
     221    case MediaSliderPart:
     222    case MediaVolumeSliderPart:
     223    case MediaFullScreenVolumeSliderPart:
     224    case SliderHorizontalPart:
     225    case SliderVerticalPart:
     226        return adjustSliderTrackStyle(styleResolver, style, e);
     227    case SliderThumbHorizontalPart:
     228    case SliderThumbVerticalPart:
     229        return adjustSliderThumbStyle(styleResolver, style, e);
     230    case SearchFieldPart:
     231        return adjustSearchFieldStyle(styleResolver, style, e);
     232    case SearchFieldCancelButtonPart:
     233        return adjustSearchFieldCancelButtonStyle(styleResolver, style, e);
     234    case SearchFieldDecorationPart:
     235        return adjustSearchFieldDecorationStyle(styleResolver, style, e);
     236    case SearchFieldResultsDecorationPart:
     237        return adjustSearchFieldResultsDecorationStyle(styleResolver, style, e);
     238    case SearchFieldResultsButtonPart:
     239        return adjustSearchFieldResultsButtonStyle(styleResolver, style, e);
    241240#if ENABLE(PROGRESS_ELEMENT)
    242         case ProgressBarPart:
    243             return adjustProgressBarStyle(styleResolver, style, e);
     241    case ProgressBarPart:
     242        return adjustProgressBarStyle(styleResolver, style, e);
    244243#endif
    245244#if ENABLE(METER_ELEMENT)
    246         case MeterPart:
    247         case RelevancyLevelIndicatorPart:
    248         case ContinuousCapacityLevelIndicatorPart:
    249         case DiscreteCapacityLevelIndicatorPart:
    250         case RatingLevelIndicatorPart:
    251             return adjustMeterStyle(styleResolver, style, e);
     245    case MeterPart:
     246    case RelevancyLevelIndicatorPart:
     247    case ContinuousCapacityLevelIndicatorPart:
     248    case DiscreteCapacityLevelIndicatorPart:
     249    case RatingLevelIndicatorPart:
     250        return adjustMeterStyle(styleResolver, style, e);
    252251#endif
    253252#if ENABLE(INPUT_SPEECH)
    254         case InputSpeechButtonPart:
    255             return adjustInputFieldSpeechButtonStyle(styleResolver, style, e);
    256 #endif
    257         default:
    258             break;
     253    case InputSpeechButtonPart:
     254        return adjustInputFieldSpeechButtonStyle(styleResolver, style, e);
     255#endif
     256    default:
     257        break;
    259258    }
    260259}
     
    277276#if USE(NEW_THEME)
    278277    switch (part) {
    279         case CheckboxPart:
    280         case RadioPart:
    281         case PushButtonPart:
    282         case SquareButtonPart:
    283         case DefaultButtonPart:
    284         case ButtonPart:
    285         case InnerSpinButtonPart:
    286             m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsContext*>(paintInfo.context), r, o->style()->effectiveZoom(), o->view()->frameView());
    287             return false;
    288         default:
    289             break;
     278    case CheckboxPart:
     279    case RadioPart:
     280    case PushButtonPart:
     281    case SquareButtonPart:
     282    case DefaultButtonPart:
     283    case ButtonPart:
     284    case InnerSpinButtonPart:
     285        m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsContext*>(paintInfo.context), r, o->style()->effectiveZoom(), o->view()->frameView());
     286        return false;
     287    default:
     288        break;
    290289    }
    291290#endif
     
    294293    switch (part) {
    295294#if !USE(NEW_THEME)
    296         case CheckboxPart:
    297             return paintCheckbox(o, paintInfo, r);
    298         case RadioPart:
    299             return paintRadio(o, paintInfo, r);
    300         case PushButtonPart:
    301         case SquareButtonPart:
    302         case DefaultButtonPart:
    303         case ButtonPart:
    304             return paintButton(o, paintInfo, r);
    305         case InnerSpinButtonPart:
    306             return paintInnerSpinButton(o, paintInfo, r);
    307 #endif
    308         case MenulistPart:
    309             return paintMenuList(o, paintInfo, r);
     295    case CheckboxPart:
     296        return paintCheckbox(o, paintInfo, r);
     297    case RadioPart:
     298        return paintRadio(o, paintInfo, r);
     299    case PushButtonPart:
     300    case SquareButtonPart:
     301    case DefaultButtonPart:
     302    case ButtonPart:
     303        return paintButton(o, paintInfo, r);
     304    case InnerSpinButtonPart:
     305        return paintInnerSpinButton(o, paintInfo, r);
     306#endif
     307    case MenulistPart:
     308        return paintMenuList(o, paintInfo, r);
    310309#if ENABLE(METER_ELEMENT)
    311         case MeterPart:
    312         case RelevancyLevelIndicatorPart:
    313         case ContinuousCapacityLevelIndicatorPart:
    314         case DiscreteCapacityLevelIndicatorPart:
    315         case RatingLevelIndicatorPart:
    316             return paintMeter(o, paintInfo, r);
     310    case MeterPart:
     311    case RelevancyLevelIndicatorPart:
     312    case ContinuousCapacityLevelIndicatorPart:
     313    case DiscreteCapacityLevelIndicatorPart:
     314    case RatingLevelIndicatorPart:
     315        return paintMeter(o, paintInfo, r);
    317316#endif
    318317#if ENABLE(PROGRESS_ELEMENT)
    319         case ProgressBarPart:
    320             return paintProgressBar(o, paintInfo, r);
    321 #endif
    322         case SliderHorizontalPart:
    323         case SliderVerticalPart:
    324             return paintSliderTrack(o, paintInfo, r);
    325         case SliderThumbHorizontalPart:
    326         case SliderThumbVerticalPart:
    327             return paintSliderThumb(o, paintInfo, r);
    328         case MediaEnterFullscreenButtonPart:
    329         case MediaExitFullscreenButtonPart:
    330             return paintMediaFullscreenButton(o, paintInfo, r);
    331         case MediaPlayButtonPart:
    332             return paintMediaPlayButton(o, paintInfo, r);
    333         case MediaOverlayPlayButtonPart:
    334             return paintMediaOverlayPlayButton(o, paintInfo, r);
    335         case MediaMuteButtonPart:
    336             return paintMediaMuteButton(o, paintInfo, r);
    337         case MediaSeekBackButtonPart:
    338             return paintMediaSeekBackButton(o, paintInfo, r);
    339         case MediaSeekForwardButtonPart:
    340             return paintMediaSeekForwardButton(o, paintInfo, r);
    341         case MediaRewindButtonPart:
    342             return paintMediaRewindButton(o, paintInfo, r);
    343         case MediaReturnToRealtimeButtonPart:
    344             return paintMediaReturnToRealtimeButton(o, paintInfo, r);
    345         case MediaToggleClosedCaptionsButtonPart:
    346             return paintMediaToggleClosedCaptionsButton(o, paintInfo, r);
    347         case MediaSliderPart:
    348             return paintMediaSliderTrack(o, paintInfo, r);
    349         case MediaSliderThumbPart:
    350             return paintMediaSliderThumb(o, paintInfo, r);
    351         case MediaVolumeSliderMuteButtonPart:
    352             return paintMediaMuteButton(o, paintInfo, r);
    353         case MediaVolumeSliderContainerPart:
    354             return paintMediaVolumeSliderContainer(o, paintInfo, r);
    355         case MediaVolumeSliderPart:
    356             return paintMediaVolumeSliderTrack(o, paintInfo, r);
    357         case MediaVolumeSliderThumbPart:
    358             return paintMediaVolumeSliderThumb(o, paintInfo, r);
    359         case MediaFullScreenVolumeSliderPart:
    360             return paintMediaFullScreenVolumeSliderTrack(o, paintInfo, r);
    361         case MediaFullScreenVolumeSliderThumbPart:
    362             return paintMediaFullScreenVolumeSliderThumb(o, paintInfo, r);
    363         case MediaTimeRemainingPart:
    364             return paintMediaTimeRemaining(o, paintInfo, r);
    365         case MediaCurrentTimePart:
    366             return paintMediaCurrentTime(o, paintInfo, r);
    367         case MediaControlsBackgroundPart:
    368             return paintMediaControlsBackground(o, paintInfo, r);
    369         case MenulistButtonPart:
    370         case TextFieldPart:
    371         case TextAreaPart:
    372         case ListboxPart:
    373             return true;
    374         case SearchFieldPart:
    375             return paintSearchField(o, paintInfo, r);
    376         case SearchFieldCancelButtonPart:
    377             return paintSearchFieldCancelButton(o, paintInfo, r);
    378         case SearchFieldDecorationPart:
    379             return paintSearchFieldDecoration(o, paintInfo, r);
    380         case SearchFieldResultsDecorationPart:
    381             return paintSearchFieldResultsDecoration(o, paintInfo, r);
    382         case SearchFieldResultsButtonPart:
    383             return paintSearchFieldResultsButton(o, paintInfo, r);
     318    case ProgressBarPart:
     319        return paintProgressBar(o, paintInfo, r);
     320#endif
     321    case SliderHorizontalPart:
     322    case SliderVerticalPart:
     323        return paintSliderTrack(o, paintInfo, r);
     324    case SliderThumbHorizontalPart:
     325    case SliderThumbVerticalPart:
     326        return paintSliderThumb(o, paintInfo, r);
     327    case MediaEnterFullscreenButtonPart:
     328    case MediaExitFullscreenButtonPart:
     329        return paintMediaFullscreenButton(o, paintInfo, r);
     330    case MediaPlayButtonPart:
     331        return paintMediaPlayButton(o, paintInfo, r);
     332    case MediaOverlayPlayButtonPart:
     333        return paintMediaOverlayPlayButton(o, paintInfo, r);
     334    case MediaMuteButtonPart:
     335        return paintMediaMuteButton(o, paintInfo, r);
     336    case MediaSeekBackButtonPart:
     337        return paintMediaSeekBackButton(o, paintInfo, r);
     338    case MediaSeekForwardButtonPart:
     339        return paintMediaSeekForwardButton(o, paintInfo, r);
     340    case MediaRewindButtonPart:
     341        return paintMediaRewindButton(o, paintInfo, r);
     342    case MediaReturnToRealtimeButtonPart:
     343        return paintMediaReturnToRealtimeButton(o, paintInfo, r);
     344    case MediaToggleClosedCaptionsButtonPart:
     345        return paintMediaToggleClosedCaptionsButton(o, paintInfo, r);
     346    case MediaSliderPart:
     347        return paintMediaSliderTrack(o, paintInfo, r);
     348    case MediaSliderThumbPart:
     349        return paintMediaSliderThumb(o, paintInfo, r);
     350    case MediaVolumeSliderMuteButtonPart:
     351        return paintMediaMuteButton(o, paintInfo, r);
     352    case MediaVolumeSliderContainerPart:
     353        return paintMediaVolumeSliderContainer(o, paintInfo, r);
     354    case MediaVolumeSliderPart:
     355        return paintMediaVolumeSliderTrack(o, paintInfo, r);
     356    case MediaVolumeSliderThumbPart:
     357        return paintMediaVolumeSliderThumb(o, paintInfo, r);
     358    case MediaFullScreenVolumeSliderPart:
     359        return paintMediaFullScreenVolumeSliderTrack(o, paintInfo, r);
     360    case MediaFullScreenVolumeSliderThumbPart:
     361        return paintMediaFullScreenVolumeSliderThumb(o, paintInfo, r);
     362    case MediaTimeRemainingPart:
     363        return paintMediaTimeRemaining(o, paintInfo, r);
     364    case MediaCurrentTimePart:
     365        return paintMediaCurrentTime(o, paintInfo, r);
     366    case MediaControlsBackgroundPart:
     367        return paintMediaControlsBackground(o, paintInfo, r);
     368    case MenulistButtonPart:
     369    case TextFieldPart:
     370    case TextAreaPart:
     371    case ListboxPart:
     372        return true;
     373    case SearchFieldPart:
     374        return paintSearchField(o, paintInfo, r);
     375    case SearchFieldCancelButtonPart:
     376        return paintSearchFieldCancelButton(o, paintInfo, r);
     377    case SearchFieldDecorationPart:
     378        return paintSearchFieldDecoration(o, paintInfo, r);
     379    case SearchFieldResultsDecorationPart:
     380        return paintSearchFieldResultsDecoration(o, paintInfo, r);
     381    case SearchFieldResultsButtonPart:
     382        return paintSearchFieldResultsButton(o, paintInfo, r);
    384383#if ENABLE(INPUT_SPEECH)
    385         case InputSpeechButtonPart:
    386             return paintInputFieldSpeechButton(o, paintInfo, r);
    387 #endif
    388         default:
    389             break;
     384    case InputSpeechButtonPart:
     385        return paintInputFieldSpeechButton(o, paintInfo, r);
     386#endif
     387    default:
     388        break;
    390389    }
    391390
     
    400399    // Call the appropriate paint method based off the appearance value.
    401400    switch (o->style()->appearance()) {
    402         case TextFieldPart:
    403             return paintTextField(o, paintInfo, r);
    404         case ListboxPart:
    405         case TextAreaPart:
    406             return paintTextArea(o, paintInfo, r);
    407         case MenulistButtonPart:
    408         case SearchFieldPart:
    409             return true;
    410         case CheckboxPart:
    411         case RadioPart:
    412         case PushButtonPart:
    413         case SquareButtonPart:
    414         case DefaultButtonPart:
    415         case ButtonPart:
    416         case MenulistPart:
     401    case TextFieldPart:
     402        return paintTextField(o, paintInfo, r);
     403    case ListboxPart:
     404    case TextAreaPart:
     405        return paintTextArea(o, paintInfo, r);
     406    case MenulistButtonPart:
     407    case SearchFieldPart:
     408        return true;
     409    case CheckboxPart:
     410    case RadioPart:
     411    case PushButtonPart:
     412    case SquareButtonPart:
     413    case DefaultButtonPart:
     414    case ButtonPart:
     415    case MenulistPart:
    417416#if ENABLE(METER_ELEMENT)
    418         case MeterPart:
    419         case RelevancyLevelIndicatorPart:
    420         case ContinuousCapacityLevelIndicatorPart:
    421         case DiscreteCapacityLevelIndicatorPart:
    422         case RatingLevelIndicatorPart:
     417    case MeterPart:
     418    case RelevancyLevelIndicatorPart:
     419    case ContinuousCapacityLevelIndicatorPart:
     420    case DiscreteCapacityLevelIndicatorPart:
     421    case RatingLevelIndicatorPart:
    423422#endif
    424423#if ENABLE(PROGRESS_ELEMENT)
    425         case ProgressBarPart:
    426 #endif
    427         case SliderHorizontalPart:
    428         case SliderVerticalPart:
    429         case SliderThumbHorizontalPart:
    430         case SliderThumbVerticalPart:
    431         case SearchFieldCancelButtonPart:
    432         case SearchFieldDecorationPart:
    433         case SearchFieldResultsDecorationPart:
    434         case SearchFieldResultsButtonPart:
     424    case ProgressBarPart:
     425#endif
     426    case SliderHorizontalPart:
     427    case SliderVerticalPart:
     428    case SliderThumbHorizontalPart:
     429    case SliderThumbVerticalPart:
     430    case SearchFieldCancelButtonPart:
     431    case SearchFieldDecorationPart:
     432    case SearchFieldResultsDecorationPart:
     433    case SearchFieldResultsButtonPart:
    435434#if ENABLE(INPUT_SPEECH)
    436         case InputSpeechButtonPart:
    437 #endif
    438         default:
    439             break;
     435    case InputSpeechButtonPart:
     436#endif
     437    default:
     438        break;
    440439    }
    441440
     
    450449    // Call the appropriate paint method based off the appearance value.
    451450    switch (o->style()->appearance()) {
    452         case MenulistButtonPart:
    453             return paintMenuListButton(o, paintInfo, r);
    454         case TextFieldPart:
    455         case TextAreaPart:
    456         case ListboxPart:
    457         case CheckboxPart:
    458         case RadioPart:
    459         case PushButtonPart:
    460         case SquareButtonPart:
    461         case DefaultButtonPart:
    462         case ButtonPart:
    463         case MenulistPart:
     451    case MenulistButtonPart:
     452        return paintMenuListButton(o, paintInfo, r);
     453    case TextFieldPart:
     454    case TextAreaPart:
     455    case ListboxPart:
     456    case CheckboxPart:
     457    case RadioPart:
     458    case PushButtonPart:
     459    case SquareButtonPart:
     460    case DefaultButtonPart:
     461    case ButtonPart:
     462    case MenulistPart:
    464463#if ENABLE(METER_ELEMENT)
    465         case MeterPart:
    466         case RelevancyLevelIndicatorPart:
    467         case ContinuousCapacityLevelIndicatorPart:
    468         case DiscreteCapacityLevelIndicatorPart:
    469         case RatingLevelIndicatorPart:
     464    case MeterPart:
     465    case RelevancyLevelIndicatorPart:
     466    case ContinuousCapacityLevelIndicatorPart:
     467    case DiscreteCapacityLevelIndicatorPart:
     468    case RatingLevelIndicatorPart:
    470469#endif
    471470#if ENABLE(PROGRESS_ELEMENT)
    472         case ProgressBarPart:
    473 #endif
    474         case SliderHorizontalPart:
    475         case SliderVerticalPart:
    476         case SliderThumbHorizontalPart:
    477         case SliderThumbVerticalPart:
    478         case SearchFieldPart:
    479         case SearchFieldCancelButtonPart:
    480         case SearchFieldDecorationPart:
    481         case SearchFieldResultsDecorationPart:
    482         case SearchFieldResultsButtonPart:
     471    case ProgressBarPart:
     472#endif
     473    case SliderHorizontalPart:
     474    case SliderVerticalPart:
     475    case SliderThumbHorizontalPart:
     476    case SliderThumbVerticalPart:
     477    case SearchFieldPart:
     478    case SearchFieldCancelButtonPart:
     479    case SearchFieldDecorationPart:
     480    case SearchFieldResultsDecorationPart:
     481    case SearchFieldResultsButtonPart:
    483482#if ENABLE(INPUT_SPEECH)
    484         case InputSpeechButtonPart:
    485 #endif
    486         default:
    487             break;
     483    case InputSpeechButtonPart:
     484#endif
     485    default:
     486        break;
    488487    }
    489488
     
    654653}
    655654
    656 bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background,
    657                                   const Color& backgroundColor) const
     655bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background, const Color& backgroundColor) const
    658656{
    659657    switch (style->appearance()) {
    660         case PushButtonPart:
    661         case SquareButtonPart:
    662         case DefaultButtonPart:
    663         case ButtonPart:
    664         case ListboxPart:
    665         case MenulistPart:
    666         case ProgressBarPart:
    667         case MeterPart:
    668         case RelevancyLevelIndicatorPart:
    669         case ContinuousCapacityLevelIndicatorPart:
    670         case DiscreteCapacityLevelIndicatorPart:
    671         case RatingLevelIndicatorPart:
    672         // FIXME: Uncomment this when making search fields style-able.
    673         // case SearchFieldPart:
    674         case TextFieldPart:
    675         case TextAreaPart:
    676             // Test the style to see if the UA border and background match.
    677             return (style->border() != border ||
    678                     *style->backgroundLayers() != background ||
    679                     style->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor);
    680         default:
    681             return false;
     658    case PushButtonPart:
     659    case SquareButtonPart:
     660    case DefaultButtonPart:
     661    case ButtonPart:
     662    case ListboxPart:
     663    case MenulistPart:
     664    case ProgressBarPart:
     665    case MeterPart:
     666    case RelevancyLevelIndicatorPart:
     667    case ContinuousCapacityLevelIndicatorPart:
     668    case DiscreteCapacityLevelIndicatorPart:
     669    case RatingLevelIndicatorPart:
     670    // FIXME: Uncomment this when making search fields style-able.
     671    // case SearchFieldPart:
     672    case TextFieldPart:
     673    case TextAreaPart:
     674        // Test the style to see if the UA border and background match.
     675        return (style->border() != border
     676            || *style->backgroundLayers() != background
     677            || style->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor);
     678    default:
     679        return false;
    682680    }
    683681}
     
    903901void RenderTheme::adjustButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
    904902{
    905     // Most platforms will completely honor all CSS, and so we have no need to adjust the style
    906     // at all by default.  We will still allow the theme a crack at setting up a desired vertical size.
     903    // Most platforms will completely honor all CSS, and so we have no need to
     904    // adjust the style at all by default. We will still allow the theme a crack
     905    // at setting up a desired vertical size.
    907906    setButtonSize(style);
    908907}
     
    11291128{
    11301129    switch (cssValueId) {
    1131         case CSSValueActiveborder:
    1132             return 0xFFFFFFFF;
    1133         case CSSValueActivecaption:
    1134             return 0xFFCCCCCC;
    1135         case CSSValueAppworkspace:
    1136             return 0xFFFFFFFF;
    1137         case CSSValueBackground:
    1138             return 0xFF6363CE;
    1139         case CSSValueButtonface:
    1140             return 0xFFC0C0C0;
    1141         case CSSValueButtonhighlight:
    1142             return 0xFFDDDDDD;
    1143         case CSSValueButtonshadow:
    1144             return 0xFF888888;
    1145         case CSSValueButtontext:
    1146             return 0xFF000000;
    1147         case CSSValueCaptiontext:
    1148             return 0xFF000000;
    1149         case CSSValueGraytext:
    1150             return 0xFF808080;
    1151         case CSSValueHighlight:
    1152             return 0xFFB5D5FF;
    1153         case CSSValueHighlighttext:
    1154             return 0xFF000000;
    1155         case CSSValueInactiveborder:
    1156             return 0xFFFFFFFF;
    1157         case CSSValueInactivecaption:
    1158             return 0xFFFFFFFF;
    1159         case CSSValueInactivecaptiontext:
    1160             return 0xFF7F7F7F;
    1161         case CSSValueInfobackground:
    1162             return 0xFFFBFCC5;
    1163         case CSSValueInfotext:
    1164             return 0xFF000000;
    1165         case CSSValueMenu:
    1166             return 0xFFC0C0C0;
    1167         case CSSValueMenutext:
    1168             return 0xFF000000;
    1169         case CSSValueScrollbar:
    1170             return 0xFFFFFFFF;
    1171         case CSSValueText:
    1172             return 0xFF000000;
    1173         case CSSValueThreeddarkshadow:
    1174             return 0xFF666666;
    1175         case CSSValueThreedface:
    1176             return 0xFFC0C0C0;
    1177         case CSSValueThreedhighlight:
    1178             return 0xFFDDDDDD;
    1179         case CSSValueThreedlightshadow:
    1180             return 0xFFC0C0C0;
    1181         case CSSValueThreedshadow:
    1182             return 0xFF888888;
    1183         case CSSValueWindow:
    1184             return 0xFFFFFFFF;
    1185         case CSSValueWindowframe:
    1186             return 0xFFCCCCCC;
    1187         case CSSValueWindowtext:
    1188             return 0xFF000000;
     1130    case CSSValueActiveborder:
     1131        return 0xFFFFFFFF;
     1132    case CSSValueActivecaption:
     1133        return 0xFFCCCCCC;
     1134    case CSSValueAppworkspace:
     1135        return 0xFFFFFFFF;
     1136    case CSSValueBackground:
     1137        return 0xFF6363CE;
     1138    case CSSValueButtonface:
     1139        return 0xFFC0C0C0;
     1140    case CSSValueButtonhighlight:
     1141        return 0xFFDDDDDD;
     1142    case CSSValueButtonshadow:
     1143        return 0xFF888888;
     1144    case CSSValueButtontext:
     1145        return 0xFF000000;
     1146    case CSSValueCaptiontext:
     1147        return 0xFF000000;
     1148    case CSSValueGraytext:
     1149        return 0xFF808080;
     1150    case CSSValueHighlight:
     1151        return 0xFFB5D5FF;
     1152    case CSSValueHighlighttext:
     1153        return 0xFF000000;
     1154    case CSSValueInactiveborder:
     1155        return 0xFFFFFFFF;
     1156    case CSSValueInactivecaption:
     1157        return 0xFFFFFFFF;
     1158    case CSSValueInactivecaptiontext:
     1159        return 0xFF7F7F7F;
     1160    case CSSValueInfobackground:
     1161        return 0xFFFBFCC5;
     1162    case CSSValueInfotext:
     1163        return 0xFF000000;
     1164    case CSSValueMenu:
     1165        return 0xFFC0C0C0;
     1166    case CSSValueMenutext:
     1167        return 0xFF000000;
     1168    case CSSValueScrollbar:
     1169        return 0xFFFFFFFF;
     1170    case CSSValueText:
     1171        return 0xFF000000;
     1172    case CSSValueThreeddarkshadow:
     1173        return 0xFF666666;
     1174    case CSSValueThreedface:
     1175        return 0xFFC0C0C0;
     1176    case CSSValueThreedhighlight:
     1177        return 0xFFDDDDDD;
     1178    case CSSValueThreedlightshadow:
     1179        return 0xFFC0C0C0;
     1180    case CSSValueThreedshadow:
     1181        return 0xFF888888;
     1182    case CSSValueWindow:
     1183        return 0xFFFFFFFF;
     1184    case CSSValueWindowframe:
     1185        return 0xFFCCCCCC;
     1186    case CSSValueWindowtext:
     1187        return 0xFF000000;
    11891188    }
    11901189    return Color();
  • trunk/Source/WebCore/rendering/RenderThemeChromiumWin.h

    r134662 r142071  
    3535namespace WebCore {
    3636
    37     struct ThemeData {
    38         ThemeData() : m_part(0), m_state(0), m_classicState(0) {}
     37struct ThemeData {
     38    ThemeData() : m_part(0), m_state(0), m_classicState(0) { }
    3939
    40         unsigned m_part;
    41         unsigned m_state;
    42         unsigned m_classicState;
     40    unsigned m_part;
     41    unsigned m_state;
     42    unsigned m_classicState;
     43};
     44
     45class RenderThemeChromiumWin : public RenderThemeChromiumSkia {
     46public:
     47    static PassRefPtr<RenderTheme> create();
     48
     49    // A method asking if the theme is able to draw the focus ring.
     50    virtual bool supportsFocusRing(const RenderStyle*) const OVERRIDE;
     51
     52    // The platform selection color.
     53    virtual Color platformActiveSelectionBackgroundColor() const OVERRIDE;
     54    virtual Color platformInactiveSelectionBackgroundColor() const OVERRIDE;
     55    virtual Color platformActiveSelectionForegroundColor() const OVERRIDE;
     56    virtual Color platformInactiveSelectionForegroundColor() const OVERRIDE;
     57    virtual Color platformActiveTextSearchHighlightColor() const OVERRIDE;
     58    virtual Color platformInactiveTextSearchHighlightColor() const OVERRIDE;
     59
     60    virtual Color systemColor(int cssValueId) const OVERRIDE;
     61
     62#if ENABLE(DATALIST_ELEMENT)
     63    virtual IntSize sliderTickSize() const OVERRIDE;
     64    virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE;
     65#endif
     66    virtual void adjustSliderThumbSize(RenderStyle*, Element*) const OVERRIDE;
     67
     68    // Various paint functions.
     69    virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     70    virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     71    virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     72    virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     73    virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     74    virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     75
     76    // MenuList refers to an unstyled menulist (meaning a menulist without
     77    // background-color or border set) and MenuListButton refers to a styled
     78    // menulist (a menulist with background-color or border set). They have
     79    // this distinction to support showing aqua style themes whenever they
     80    // possibly can, which is something we don't want to replicate.
     81    //
     82    // In short, we either go down the MenuList code path or the MenuListButton
     83    // codepath. We never go down both. And in both cases, they render the
     84    // entire menulist.
     85    virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     86
     87    virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const OVERRIDE;
     88    virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     89
     90#if ENABLE(PROGRESS_ELEMENT)
     91    virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const OVERRIDE;
     92    virtual double animationDurationForProgressBar(RenderProgress*) const OVERRIDE;
     93    virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const OVERRIDE;
     94    virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
     95#endif
     96
     97    virtual bool shouldOpenPickerWithF4Key() const OVERRIDE;
     98
     99protected:
     100    virtual double caretBlinkIntervalInternal() const OVERRIDE;
     101
     102private:
     103    enum ControlSubPart {
     104        None,
     105        SpinButtonDown,
     106        SpinButtonUp,
    43107    };
    44108
    45     class RenderThemeChromiumWin : public RenderThemeChromiumSkia {
    46     public:
    47         static PassRefPtr<RenderTheme> create();
     109    RenderThemeChromiumWin() { }
     110    virtual ~RenderThemeChromiumWin() { }
    48111
    49         // A method asking if the theme is able to draw the focus ring.
    50         virtual bool supportsFocusRing(const RenderStyle*) const;
     112    unsigned determineState(RenderObject*, ControlSubPart = None);
     113    unsigned determineSliderThumbState(RenderObject*);
     114    unsigned determineClassicState(RenderObject*, ControlSubPart = None);
    51115
    52         // The platform selection color.
    53         virtual Color platformActiveSelectionBackgroundColor() const;
    54         virtual Color platformInactiveSelectionBackgroundColor() const;
    55         virtual Color platformActiveSelectionForegroundColor() const;
    56         virtual Color platformInactiveSelectionForegroundColor() const;
    57         virtual Color platformActiveTextSearchHighlightColor() const;
    58         virtual Color platformInactiveTextSearchHighlightColor() const;
     116    ThemeData getThemeData(RenderObject*, ControlSubPart = None);
    59117
    60         virtual Color systemColor(int cssValueId) const;
    61 
    62 #if ENABLE(DATALIST_ELEMENT)
    63         virtual IntSize sliderTickSize() const OVERRIDE;
    64         virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE;
    65 #endif
    66         virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
    67 
    68         // Various paint functions.
    69         virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&);
    70         virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&);
    71         virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
    72         virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
    73         virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
    74         virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
    75 
    76         // MenuList refers to an unstyled menulist (meaning a menulist without
    77         // background-color or border set) and MenuListButton refers to a styled
    78         // menulist (a menulist with background-color or border set). They have
    79         // this distinction to support showing aqua style themes whenever they
    80         // possibly can, which is something we don't want to replicate.
    81         //
    82         // In short, we either go down the MenuList code path or the MenuListButton
    83         // codepath. We never go down both. And in both cases, they render the
    84         // entire menulist.
    85         virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
    86 
    87         virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
    88         virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
    89 
    90 #if ENABLE(PROGRESS_ELEMENT)
    91         virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
    92         virtual double animationDurationForProgressBar(RenderProgress*) const;
    93         virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const;
    94         virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
    95 #endif
    96 
    97         virtual bool shouldOpenPickerWithF4Key() const OVERRIDE;
    98 
    99     protected:
    100         virtual double caretBlinkIntervalInternal() const;
    101 
    102     private:
    103         enum ControlSubPart {
    104             None,
    105             SpinButtonDown,
    106             SpinButtonUp,
    107         };
    108 
    109         RenderThemeChromiumWin() { }
    110         virtual ~RenderThemeChromiumWin() { }
    111 
    112         unsigned determineState(RenderObject*, ControlSubPart = None);
    113         unsigned determineSliderThumbState(RenderObject*);
    114         unsigned determineClassicState(RenderObject*, ControlSubPart = None);
    115 
    116         ThemeData getThemeData(RenderObject*, ControlSubPart = None);
    117 
    118         bool paintTextFieldInternal(RenderObject*, const PaintInfo&, const IntRect&, bool);
    119     };
     118    bool paintTextFieldInternal(RenderObject*, const PaintInfo&, const IntRect&, bool);
     119};
    120120
    121121} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.