Changeset 44776 in webkit


Ignore:
Timestamp:
Jun 17, 2009 12:18:10 PM (15 years ago)
Author:
levin@chromium.org
Message:

2009-06-17 Albert J. Wong <ajwong@chromium.org>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=26148
Remove common code from RenderThemeChromiumWin that is shared with
RenderThemeChromiumSkia.

Also move supportsControlTints to RenderThemeChromiumLinux since it
is linux specific.

There are no tests changed because this just removes functions with
duplicate implementations between the base and derived classes.

  • rendering/RenderThemeChromiumLinux.cpp: (WebCore::RenderThemeChromiumLinux::supportsControlTints):
  • rendering/RenderThemeChromiumLinux.h:
  • rendering/RenderThemeChromiumSkia.cpp:
  • rendering/RenderThemeChromiumSkia.h:
  • rendering/RenderThemeChromiumWin.cpp: (WebCore::): (WebCore::getNonClientMetrics): (WebCore::RenderThemeChromiumWin::RenderThemeChromiumWin): (WebCore::RenderThemeChromiumWin::~RenderThemeChromiumWin): (WebCore::RenderThemeChromiumWin::systemFont): (WebCore::RenderThemeChromiumWin::paintCheckbox): (WebCore::RenderThemeChromiumWin::paintRadio): (WebCore::RenderThemeChromiumWin::paintSliderThumb): (WebCore::RenderThemeChromiumWin::caretBlinkIntervalInternal):
  • rendering/RenderThemeChromiumWin.h:
Location:
trunk/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r44775 r44776  
     12009-06-17  Albert J. Wong  <ajwong@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=26148
     6        Remove common code from RenderThemeChromiumWin that is shared with
     7        RenderThemeChromiumSkia.
     8
     9        Also move supportsControlTints to RenderThemeChromiumLinux since it
     10        is linux specific.
     11
     12        There are no tests changed because this just removes functions with
     13        duplicate implementations between the base and derived classes.
     14
     15        * rendering/RenderThemeChromiumLinux.cpp:
     16        (WebCore::RenderThemeChromiumLinux::supportsControlTints):
     17        * rendering/RenderThemeChromiumLinux.h:
     18        * rendering/RenderThemeChromiumSkia.cpp:
     19        * rendering/RenderThemeChromiumSkia.h:
     20        * rendering/RenderThemeChromiumWin.cpp:
     21        (WebCore::):
     22        (WebCore::getNonClientMetrics):
     23        (WebCore::RenderThemeChromiumWin::RenderThemeChromiumWin):
     24        (WebCore::RenderThemeChromiumWin::~RenderThemeChromiumWin):
     25        (WebCore::RenderThemeChromiumWin::systemFont):
     26        (WebCore::RenderThemeChromiumWin::paintCheckbox):
     27        (WebCore::RenderThemeChromiumWin::paintRadio):
     28        (WebCore::RenderThemeChromiumWin::paintSliderThumb):
     29        (WebCore::RenderThemeChromiumWin::caretBlinkIntervalInternal):
     30        * rendering/RenderThemeChromiumWin.h:
     31
    1322009-06-17  Albert J. Wong  <ajwong@chromium.org>
    233
  • trunk/WebCore/rendering/RenderThemeChromiumLinux.cpp

    r44775 r44776  
    8686}
    8787
     88bool RenderThemeChromiumLinux::supportsControlTints() const
     89{
     90    return true;
     91}
     92
    8893} // namespace WebCore
  • trunk/WebCore/rendering/RenderThemeChromiumLinux.h

    r44775 r44776  
    5353        RenderThemeChromiumLinux();
    5454        virtual ~RenderThemeChromiumLinux();
     55
     56        // A general method asking if any control tinting is supported at all.
     57        virtual bool supportsControlTints() const;
    5558    };
    5659
  • trunk/WebCore/rendering/RenderThemeChromiumSkia.cpp

    r44775 r44776  
    163163}
    164164
    165 Color RenderThemeChromiumSkia::platformTextSearchHighlightColor() const
    166 {
    167     return Color(0xff, 0xff, 0x96);
    168 }
    169 
    170165double RenderThemeChromiumSkia::caretBlinkInterval() const
    171166{
  • trunk/WebCore/rendering/RenderThemeChromiumSkia.h

    r44775 r44776  
    5555        virtual Color platformActiveSelectionForegroundColor() const;
    5656        virtual Color platformInactiveSelectionForegroundColor() const;
    57         virtual Color platformTextSearchHighlightColor() const;
    5857
    5958        // To change the blink interval, override caretBlinkIntervalInternal instead of this one so that we may share layout test code an intercepts.
     
    118117        virtual int buttonInternalPaddingBottom() const;
    119118
    120         // A general method asking if any control tinting is supported at all.
    121         virtual bool supportsControlTints() const { return true; }
    122 
    123119    protected:
    124120        static const String& defaultGUIFont();
  • trunk/WebCore/rendering/RenderThemeChromiumWin.cpp

    r44758 r44776  
    3131
    3232#include "ChromiumBridge.h"
    33 #include "CSSStyleSheet.h"
    3433#include "CSSValueKeywords.h"
    3534#include "FontSelector.h"
     
    4241#include "RenderSlider.h"
    4342#include "ScrollbarTheme.h"
    44 #include "SkiaUtils.h"
    4543#include "TransparencyWin.h"
    46 #include "UserAgentStyleSheets.h"
    4744#include "WindowsVersion.h"
    4845
     
    5956
    6057namespace {
    61 
    62 // The background for the media player controls should be a 60% opaque black rectangle. This
    63 // matches the UI mockups for the default UI theme.
    64 static const float defaultMediaControlOpacity = 0.6f;
    65 
    66 // These values all match Safari/Win.
    67 static const float defaultControlFontPixelSize = 13;
    68 static const float defaultCancelButtonSize = 9;
    69 static const float minCancelButtonSize = 5;
    70 static const float maxCancelButtonSize = 21;
    71 static const float defaultSearchFieldResultsDecorationSize = 13;
    72 static const float minSearchFieldResultsDecorationSize = 9;
    73 static const float maxSearchFieldResultsDecorationSize = 30;
    74 static const float defaultSearchFieldResultsButtonWidth = 18;
    75 
    76 bool canvasHasMultipleLayers(const SkCanvas* canvas)
    77 {
    78     SkCanvas::LayerIter iter(const_cast<SkCanvas*>(canvas), false);
    79     iter.next();  // There is always at least one layer.
    80     return !iter.done();  // There is > 1 layer if the the iterator can stil advance.
    81 }
    82 
    8358class ThemePainter : public TransparencyWin {
    8459public:
     
    9570
    9671private:
     72    static bool canvasHasMultipleLayers(const SkCanvas* canvas)
     73    {
     74        SkCanvas::LayerIter iter(const_cast<SkCanvas*>(canvas), false);
     75        iter.next();  // There is always at least one layer.
     76        return !iter.done();  // There is > 1 layer if the the iterator can stil advance.
     77    }
     78
    9779    static LayerMode getLayerMode(GraphicsContext* context, TransformMode transformMode)
    9880    {
     
    118100}  // namespace
    119101
    120 static void getNonClientMetrics(NONCLIENTMETRICS* metrics) {
     102static void getNonClientMetrics(NONCLIENTMETRICS* metrics)
     103{
    121104    static UINT size = WebCore::isVistaOrNewer() ?
    122105        sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
     
    125108    ASSERT(success);
    126109}
    127 
    128 enum PaddingType {
    129     TopPadding,
    130     RightPadding,
    131     BottomPadding,
    132     LeftPadding
    133 };
    134 
    135 static const int styledMenuListInternalPadding[4] = { 1, 4, 1, 4 };
    136 
    137 // The default variable-width font size.  We use this as the default font
    138 // size for the "system font", and as a base size (which we then shrink) for
    139 // form control fonts.
    140 static float defaultFontSize = 16.0;
    141110
    142111static FontDescription smallSystemFont;
     
    159128    }
    160129    return false;
    161 }
    162 
    163 static void setFixedPadding(RenderStyle* style, const int padding[4])
    164 {
    165     style->setPaddingLeft(Length(padding[LeftPadding], Fixed));
    166     style->setPaddingRight(Length(padding[RightPadding], Fixed));
    167     style->setPaddingTop(Length(padding[TopPadding], Fixed));
    168     style->setPaddingBottom(Length(padding[BottomPadding], Fixed));
    169130}
    170131
     
    203164}
    204165
    205 // We aim to match IE here.
    206 // -IE uses a font based on the encoding as the default font for form controls.
    207 // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT),
    208 // which returns MS Shell Dlg)
    209 // -Safari uses Lucida Grande.
    210 //
    211 // FIXME: The only case where we know we don't match IE is for ANSI encodings.
    212 // IE uses MS Shell Dlg there, which we render incorrectly at certain pixel
    213 // sizes (e.g. 15px). So, for now we just use Arial.
    214 static wchar_t* defaultGUIFont()
    215 {
    216     return L"Arial";
    217 }
    218 
    219166// Converts |points| to pixels.  One point is 1/72 of an inch.
    220167static float pointsToPixels(float points)
     
    235182}
    236183
    237 static void setSizeIfAuto(RenderStyle* style, const IntSize& size)
    238 {
    239     if (style->width().isIntrinsicOrAuto())
    240         style->setWidth(Length(size.width(), Fixed));
    241     if (style->height().isAuto())
    242         style->setHeight(Length(size.height(), Fixed));
    243 }
    244 
    245184static double querySystemBlinkInterval(double defaultInterval)
    246185{
     
    253192}
    254193
    255 #if ENABLE(VIDEO)
    256 // Attempt to retrieve a HTMLMediaElement from a Node. Returns NULL if one cannot be found.
    257 static HTMLMediaElement* mediaElementParent(Node* node)
    258 {
    259     if (!node)
    260         return 0;
    261     Node* mediaNode = node->shadowAncestorNode();
    262     if (!mediaNode || (!mediaNode->hasTagName(HTMLNames::videoTag) && !mediaNode->hasTagName(HTMLNames::audioTag)))
    263         return 0;
    264 
    265     return static_cast<HTMLMediaElement*>(mediaNode);
    266 }
    267 #endif
    268 
    269194PassRefPtr<RenderTheme> RenderThemeChromiumWin::create()
    270195{
     
    277202    return rt;
    278203}
    279 
    280 String RenderThemeChromiumWin::extraDefaultStyleSheet()
    281 {
    282     return String(themeWinUserAgentStyleSheet, sizeof(themeWinUserAgentStyleSheet));
    283 }
    284 
    285 String RenderThemeChromiumWin::extraQuirksStyleSheet()
    286 {
    287     return String(themeWinQuirksUserAgentStyleSheet, sizeof(themeWinQuirksUserAgentStyleSheet));
    288 }
    289 
    290 #if ENABLE(VIDEO)
    291 String RenderThemeChromiumWin::extraMediaControlsStyleSheet()
    292 {
    293     return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet));
    294 }
    295 #endif
    296204
    297205bool RenderThemeChromiumWin::supportsFocusRing(const RenderStyle* style) const
     
    343251}
    344252
    345 double RenderThemeChromiumWin::caretBlinkInterval() const
    346 {
    347     // Disable the blinking caret in layout test mode, as it introduces
    348     // a race condition for the pixel tests. http://b/1198440
    349     if (ChromiumBridge::layoutTestMode())
    350         return 0;
    351 
    352     // This involves a system call, so we cache the result.
    353     static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBlinkInterval());
    354     return blinkInterval;
    355 }
    356 
    357253void RenderThemeChromiumWin::systemFont(int propId, FontDescription& fontDescription) const
    358254{
    359255    // This logic owes much to RenderThemeSafari.cpp.
    360     FontDescription* cachedDesc = NULL;
    361     wchar_t* faceName = 0;
     256    FontDescription* cachedDesc = 0;
     257    AtomicString faceName;
    362258    float fontSize = 0;
    363259    switch (propId) {
     
    367263            NONCLIENTMETRICS metrics;
    368264            getNonClientMetrics(&metrics);
    369             faceName = metrics.lfSmCaptionFont.lfFaceName;
     265            faceName = AtomicString(metrics.lfSmCaptionFont.lfFaceName, wcslen(metrics.lfSmCaptionFont.lfFaceName));
    370266            fontSize = systemFontSize(metrics.lfSmCaptionFont);
    371267        }
     
    376272            NONCLIENTMETRICS metrics;
    377273            getNonClientMetrics(&metrics);
    378             faceName = metrics.lfMenuFont.lfFaceName;
     274            faceName = AtomicString(metrics.lfMenuFont.lfFaceName, wcslen(metrics.lfMenuFont.lfFaceName));
    379275            fontSize = systemFontSize(metrics.lfMenuFont);
    380276        }
     
    406302
    407303    if (fontSize) {
    408         ASSERT(faceName);
    409         cachedDesc->firstFamily().setFamily(AtomicString(faceName,
    410                                                          wcslen(faceName)));
     304        cachedDesc->firstFamily().setFamily(faceName);
    411305        cachedDesc->setIsAbsoluteSize(true);
    412306        cachedDesc->setGenericFamily(FontDescription::NoFamily);
     
    416310    }
    417311    fontDescription = *cachedDesc;
    418 }
    419 
    420 int RenderThemeChromiumWin::minimumMenuListSize(RenderStyle* style) const
    421 {
    422     return 0;
    423312}
    424313
     
    437326}
    438327
    439 void RenderThemeChromiumWin::setCheckboxSize(RenderStyle* style) const
    440 {
    441     // If the width and height are both specified, then we have nothing to do.
    442     if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
    443         return;
    444 
    445     // FIXME:  A hard-coded size of 13 is used.  This is wrong but necessary
    446     // for now.  It matches Firefox.  At different DPI settings on Windows,
    447     // querying the theme gives you a larger size that accounts for the higher
    448     // DPI.  Until our entire engine honors a DPI setting other than 96, we
    449     // can't rely on the theme's metrics.
    450     const IntSize size(13, 13);
    451     setSizeIfAuto(style, size);
    452 }
    453 
    454 void RenderThemeChromiumWin::setRadioSize(RenderStyle* style) const
    455 {
    456     // Use same sizing for radio box as checkbox.
    457     setCheckboxSize(style);
     328bool RenderThemeChromiumWin::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
     329{
     330    return paintButton(o, i, r);
     331}
     332bool RenderThemeChromiumWin::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
     333{
     334    return paintButton(o, i, r);
    458335}
    459336
     
    489366}
    490367
    491 void RenderThemeChromiumWin::adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
    492 {
    493     // Scale the button size based on the font size
    494     float fontScale = style->fontSize() / defaultControlFontPixelSize;
    495     int cancelButtonSize = lroundf(std::min(std::max(minCancelButtonSize, defaultCancelButtonSize * fontScale), maxCancelButtonSize));
    496     style->setWidth(Length(cancelButtonSize, Fixed));
    497     style->setHeight(Length(cancelButtonSize, Fixed));
    498 }
    499 
    500 bool RenderThemeChromiumWin::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    501 {
    502     IntRect bounds = r;
    503     ASSERT(o->parent());
    504     if (!o->parent() || !o->parent()->isBox())
    505         return false;
    506    
    507     RenderBox* parentRenderBox = toRenderBox(o->parent());
    508 
    509     IntRect parentBox = parentRenderBox->absoluteContentBox();
    510    
    511     // Make sure the scaled button stays square and will fit in its parent's box
    512     bounds.setHeight(std::min(parentBox.width(), std::min(parentBox.height(), bounds.height())));
    513     bounds.setWidth(bounds.height());
    514 
    515     // Center the button vertically.  Round up though, so if it has to be one pixel off-center, it will
    516     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
    517     bounds.setY(parentBox.y() + (parentBox.height() - bounds.height() + 1) / 2);
    518 
    519     static Image* cancelImage = Image::loadPlatformResource("searchCancel").releaseRef();
    520     static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelPressed").releaseRef();
    521     i.context->drawImage(isPressed(o) ? cancelPressedImage : cancelImage, bounds);
    522     return false;
    523 }
    524 
    525 void RenderThemeChromiumWin::adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
    526 {
    527     IntSize emptySize(1, 11);
    528     style->setWidth(Length(emptySize.width(), Fixed));
    529     style->setHeight(Length(emptySize.height(), Fixed));
    530 }
    531 
    532 void RenderThemeChromiumWin::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
    533 {
    534     // Scale the decoration size based on the font size
    535     float fontScale = style->fontSize() / defaultControlFontPixelSize;
    536     int magnifierSize = lroundf(std::min(std::max(minSearchFieldResultsDecorationSize, defaultSearchFieldResultsDecorationSize * fontScale),
    537                                          maxSearchFieldResultsDecorationSize));
    538     style->setWidth(Length(magnifierSize, Fixed));
    539     style->setHeight(Length(magnifierSize, Fixed));
    540 }
    541 
    542 bool RenderThemeChromiumWin::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    543 {
    544     IntRect bounds = r;
    545     ASSERT(o->parent());
    546     if (!o->parent() || !o->parent()->isBox())
    547         return false;
    548    
    549     RenderBox* parentRenderBox = toRenderBox(o->parent());
    550     IntRect parentBox = parentRenderBox->absoluteContentBox();
    551    
    552     // Make sure the scaled decoration stays square and will fit in its parent's box
    553     bounds.setHeight(std::min(parentBox.width(), std::min(parentBox.height(), bounds.height())));
    554     bounds.setWidth(bounds.height());
    555 
    556     // Center the decoration vertically.  Round up though, so if it has to be one pixel off-center, it will
    557     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
    558     bounds.setY(parentBox.y() + (parentBox.height() - bounds.height() + 1) / 2);
    559    
    560     static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").releaseRef();
    561     i.context->drawImage(magnifierImage, bounds);
    562     return false;
    563 }
    564 
    565 void RenderThemeChromiumWin::adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
    566 {
    567     // Scale the button size based on the font size
    568     float fontScale = style->fontSize() / defaultControlFontPixelSize;
    569     int magnifierHeight = lroundf(std::min(std::max(minSearchFieldResultsDecorationSize, defaultSearchFieldResultsDecorationSize * fontScale),
    570                                            maxSearchFieldResultsDecorationSize));
    571     int magnifierWidth = lroundf(magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
    572     style->setWidth(Length(magnifierWidth, Fixed));
    573     style->setHeight(Length(magnifierHeight, Fixed));
    574 }
    575 
    576 bool RenderThemeChromiumWin::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    577 {
    578     IntRect bounds = r;
    579     ASSERT(o->parent());
    580     if (!o->parent())
    581         return false;
    582     if (!o->parent() || !o->parent()->isBox())
    583         return false;
    584    
    585     RenderBox* parentRenderBox = toRenderBox(o->parent());
    586     IntRect parentBox = parentRenderBox->absoluteContentBox();
    587    
    588     // Make sure the scaled decoration will fit in its parent's box
    589     bounds.setHeight(std::min(parentBox.height(), bounds.height()));
    590     bounds.setWidth(std::min(parentBox.width(), static_cast<int>(bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize)));
    591 
    592     // Center the button vertically.  Round up though, so if it has to be one pixel off-center, it will
    593     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
    594     bounds.setY(parentBox.y() + (parentBox.height() - bounds.height() + 1) / 2);
    595 
    596     static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").releaseRef();
    597     i.context->drawImage(magnifierImage, bounds);
    598     return false;
    599 }
    600 
    601 bool RenderThemeChromiumWin::paintMediaButtonInternal(GraphicsContext* context, const IntRect& rect, Image* image)
    602 {
    603     context->beginTransparencyLayer(defaultMediaControlOpacity);
    604 
    605     // Draw background.
    606     Color oldFill = context->fillColor();
    607     Color oldStroke = context->strokeColor();
    608 
    609     context->setFillColor(Color::black);
    610     context->setStrokeColor(Color::black);
    611     context->drawRect(rect);
    612 
    613     context->setFillColor(oldFill);
    614     context->setStrokeColor(oldStroke);
    615 
    616     // Create a destination rectangle for the image that is centered in the drawing rectangle, rounded left, and down.
    617     IntRect imageRect = image->rect();
    618     imageRect.setY(rect.y() + (rect.height() - image->height() + 1) / 2);
    619     imageRect.setX(rect.x() + (rect.width() - image->width() + 1) / 2);
    620 
    621     context->drawImage(image, imageRect, CompositeSourceAtop);
    622     context->endTransparencyLayer();
    623 
    624     return false;
    625 }
    626 
    627 bool RenderThemeChromiumWin::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
    628 {
    629 #if ENABLE(VIDEO)
    630     HTMLMediaElement* mediaElement = mediaElementParent(o->node());
    631     if (!mediaElement)
    632         return false;
    633 
    634     static Image* mediaPlay = Image::loadPlatformResource("mediaPlay").releaseRef();
    635     static Image* mediaPause = Image::loadPlatformResource("mediaPause").releaseRef();
    636 
    637     return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause);
    638 #else
    639     return false;
    640 #endif
    641 }
    642 
    643 bool RenderThemeChromiumWin::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
    644 {
    645 #if ENABLE(VIDEO)
    646     HTMLMediaElement* mediaElement = mediaElementParent(o->node());
    647     if (!mediaElement)
    648         return false;
    649 
    650     static Image* soundFull = Image::loadPlatformResource("mediaSoundFull").releaseRef();
    651     static Image* soundNone = Image::loadPlatformResource("mediaSoundNone").releaseRef();
    652 
    653     return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->muted() ? soundNone: soundFull);
    654 #else
    655     return false;
    656 #endif
    657 }
    658 
    659 void RenderThemeChromiumWin::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
    660 {
    661     // Height is locked to auto on all browsers.
    662     style->setLineHeight(RenderStyle::initialLineHeight());
     368bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
     369{
     370    return paintSliderTrack(o, i, r);
    663371}
    664372
     
    715423}
    716424
    717 void RenderThemeChromiumWin::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
    718 {
    719     adjustMenuListStyle(selector, style, e);
    720 }
    721 
    722 // Used to paint styled menulists (i.e. with a non-default border)
    723 bool RenderThemeChromiumWin::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    724 {
    725     return paintMenuList(o, i, r);
    726 }
    727 
    728 int RenderThemeChromiumWin::popupInternalPaddingLeft(RenderStyle* style) const
    729 {
    730     return menuListInternalPadding(style, LeftPadding);
    731 }
    732 
    733 int RenderThemeChromiumWin::popupInternalPaddingRight(RenderStyle* style) const
    734 {
    735     return menuListInternalPadding(style, RightPadding);
    736 }
    737 
    738 int RenderThemeChromiumWin::popupInternalPaddingTop(RenderStyle* style) const
    739 {
    740     return menuListInternalPadding(style, TopPadding);
    741 }
    742 
    743 int RenderThemeChromiumWin::popupInternalPaddingBottom(RenderStyle* style) const
    744 {
    745     return menuListInternalPadding(style, BottomPadding);
    746 }
    747 
    748 int RenderThemeChromiumWin::buttonInternalPaddingLeft() const
    749 {
    750     return 3;
    751 }
    752 
    753 int RenderThemeChromiumWin::buttonInternalPaddingRight() const
    754 {
    755     return 3;
    756 }
    757 
    758 int RenderThemeChromiumWin::buttonInternalPaddingTop() const
    759 {
    760     return 1;
    761 }
    762 
    763 int RenderThemeChromiumWin::buttonInternalPaddingBottom() const
    764 {
    765     return 1;
    766 }
    767 
    768425// static
    769426void RenderThemeChromiumWin::setDefaultFontSize(int fontSize)
     
    773430    // Reset cached fonts.
    774431    smallSystemFont = menuFont = labelFont = FontDescription();
     432}
     433
     434double RenderThemeChromiumWin::caretBlinkIntervalInternal() const
     435{
     436    // This involves a system call, so we cache the result.
     437    static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBlinkInterval());
     438    return blinkInterval;
    775439}
    776440
     
    915579}
    916580
    917 int RenderThemeChromiumWin::menuListInternalPadding(RenderStyle* style, int paddingType) const
    918 {
    919     // This internal padding is in addition to the user-supplied padding.
    920     // Matches the FF behavior.
    921     int padding = styledMenuListInternalPadding[paddingType];
    922 
    923     // Reserve the space for right arrow here. The rest of the padding is set
    924     // by adjustMenuListStyle, since PopupMenuChromium.cpp uses the padding
    925     // from RenderMenuList to lay out the individual items in the popup.  If
    926     // the MenuList actually has appearance "NoAppearance", then that means we
    927     // don't draw a button, so don't reserve space for it.
    928     const int barType = style->direction() == LTR ? RightPadding : LeftPadding;
    929     if (paddingType == barType && style->appearance() != NoControlPart)
    930         padding += ScrollbarTheme::nativeTheme()->scrollbarThickness();
    931 
    932     return padding;
    933 }
    934 
    935581} // namespace WebCore
  • trunk/WebCore/rendering/RenderThemeChromiumWin.h

    r44758 r44776  
    2525#define RenderThemeChromiumWin_h
    2626
    27 #include "RenderTheme.h"
     27#include "RenderThemeChromiumSkia.h"
    2828
    2929#if WIN32
     
    4343    };
    4444
    45     class RenderThemeChromiumWin : public RenderTheme {
     45    class RenderThemeChromiumWin : public RenderThemeChromiumSkia {
    4646    public:
    4747        static PassRefPtr<RenderTheme> create();
    48 
    49         virtual String extraDefaultStyleSheet();
    50         virtual String extraQuirksStyleSheet();
    51 #if ENABLE(VIDEO)
    52         virtual String extraMediaControlsStyleSheet();
    53 #endif
    54 
    55         // A method asking if the theme's controls actually care about redrawing when hovered.
    56         virtual bool supportsHover(const RenderStyle*) const { return true; }
    5748
    5849        // A method asking if the theme is able to draw the focus ring.
     
    6758        virtual Color platformInactiveTextSearchHighlightColor() const;
    6859
    69         virtual double caretBlinkInterval() const;
    70 
    7160        // System fonts.
    7261        virtual void systemFont(int propId, FontDescription&) const;
    7362
    74         virtual int minimumMenuListSize(RenderStyle*) const;
    75 
    7663        virtual void adjustSliderThumbSize(RenderObject*) const;
    7764
    78         virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); }
    79         virtual void setCheckboxSize(RenderStyle*) const;
    80 
    81         virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); }
    82         virtual void setRadioSize(RenderStyle*) const;
    83 
     65        // Various paint functions.
     66        virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     67        virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    8468        virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    85 
    8669        virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    87 
    88         virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); }
    89 
    9070        virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    91 
    92         virtual bool paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintSliderTrack(o, i, r); }
    93 
    94         virtual bool paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); }
    95 
    96         virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    97         virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    98 
    99         virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    100 
    101         virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    102         virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    103 
    104         virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    105         virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    106 
    107         virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    108         virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     71        virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    10972
    11073        // MenuList refers to an unstyled menulist (meaning a menulist without
     
    11780        // codepath. We never go down both. And in both cases, they render the
    11881        // entire menulist.
    119         virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    12082        virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    121         virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    122         virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    123 
    124         // These methods define the padding for the MenuList's inner block.
    125         virtual int popupInternalPaddingLeft(RenderStyle*) const;
    126         virtual int popupInternalPaddingRight(RenderStyle*) const;
    127         virtual int popupInternalPaddingTop(RenderStyle*) const;
    128         virtual int popupInternalPaddingBottom(RenderStyle*) const;
    129 
    130         virtual int buttonInternalPaddingLeft() const;
    131         virtual int buttonInternalPaddingRight() const;
    132         virtual int buttonInternalPaddingTop() const;
    133         virtual int buttonInternalPaddingBottom() const;
    13483
    13584        // Provide a way to pass the default font size from the Settings object
     
    14089        static void setDefaultFontSize(int);
    14190
     91    protected:
     92        virtual double caretBlinkIntervalInternal() const;
     93
    14294    private:
    143         RenderThemeChromiumWin() { }
    144         ~RenderThemeChromiumWin() { }
     95        RenderThemeChromiumWin();
     96        virtual ~RenderThemeChromiumWin();
    14597
    14698        unsigned determineState(RenderObject*);
     
    151103
    152104        bool paintTextFieldInternal(RenderObject*, const RenderObject::PaintInfo&, const IntRect&, bool);
    153         bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
    154 
    155         int menuListInternalPadding(RenderStyle*, int paddingType) const;
    156105    };
    157106
Note: See TracChangeset for help on using the changeset viewer.