Changeset 86299 in webkit


Ignore:
Timestamp:
May 11, 2011 6:20:34 PM (13 years ago)
Author:
alexis.menard@openbossa.org
Message:

2011-05-11 Alexis Menard <alexis.menard@openbossa.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Implements a disable appearance for Media Elements of Qt port.
https://bugs.webkit.org/show_bug.cgi?id=60561

Implements a disable appearance for the media controls of the Qt port
when the media is not yet available.

  • platform/qt/RenderThemeQt.cpp: (WebCore::mediaElementCanPlay): (WebCore::RenderThemeQt::getMediaControlForegroundColor): (WebCore::RenderThemeQt::paintMediaSliderThumb):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86298 r86299  
     12011-05-11  Alexis Menard  <alexis.menard@openbossa.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Implements a disable appearance for Media Elements of Qt port.
     6        https://bugs.webkit.org/show_bug.cgi?id=60561
     7
     8        Implements a disable appearance for the media controls of the Qt port
     9        when the media is not yet available.
     10
     11        * platform/qt/RenderThemeQt.cpp:
     12        (WebCore::mediaElementCanPlay):
     13        (WebCore::RenderThemeQt::getMediaControlForegroundColor):
     14        (WebCore::RenderThemeQt::paintMediaSliderThumb):
     15
    1162011-05-11  Kent Tamura  <tkent@chromium.org>
    217
  • trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp

    r86135 r86299  
    12091209}
    12101210
     1211static bool mediaElementCanPlay(RenderObject* o)
     1212{
     1213    HTMLMediaElement* mediaElement = toParentMediaElement(o);
     1214    if (!mediaElement)
     1215        return false;
     1216
     1217    return mediaElement->readyState() > HTMLMediaElement::HAVE_METADATA
     1218           || (mediaElement->readyState() == HTMLMediaElement::HAVE_NOTHING
     1219               && o->style()->appearance() == MediaPlayButtonPart && mediaElement->preload() == "none");
     1220}
     1221
    12111222QColor RenderThemeQt::getMediaControlForegroundColor(RenderObject* o) const
    12121223{
    12131224    QColor fgColor = platformActiveSelectionBackgroundColor();
    1214     if (o && o->node()->active())
     1225    if (!o)
     1226        return fgColor;
     1227
     1228    if (o->node()->active())
    12151229        fgColor = fgColor.lighter();
     1230
     1231    if (!mediaElementCanPlay(o)) {
     1232        QPalette pal = QApplication::palette();
     1233        setPaletteFromPageClientIfExists(pal);
     1234        fgColor = pal.brush(QPalette::Disabled, QPalette::Text).color();
     1235    }
     1236
    12161237    return fgColor;
    12171238}
     
    14211442bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
    14221443{
     1444    if (!o->parent()->isSlider())
     1445        return false;
     1446
     1447    // We can get the HTMLMediaElement from the parent of the thumb : MediaControlTimelineElement.
     1448    HTMLMediaElement* mediaElement = toParentMediaElement(o->parent());
     1449    if (!mediaElement)
     1450        return false;
     1451
    14231452    StylePainter p(this, paintInfo);
    14241453    if (!p.isValid())
     
    14281457
    14291458    p.painter->setPen(Qt::NoPen);
    1430     p.painter->setBrush(getMediaControlForegroundColor(o));
     1459    p.painter->setBrush(getMediaControlForegroundColor(o->parent()));
    14311460    p.painter->drawRect(r.x(), r.y(), r.width(), r.height());
    14321461
Note: See TracChangeset for help on using the changeset viewer.