Changeset 39238 in webkit


Ignore:
Timestamp:
Dec 12, 2008, 5:18:30 AM (16 years ago)
Author:
vestbo@webkit.org
Message:

2008-12-12 Tor Arne Vestbø <tavestbo@trolltech.com>

Rubber-stamped by Oliver Hunt.

Share PluginView::paintMissingPluginIcon() between ports

Also, enable this feature for Qt/X11, Qt/Mac and GTK

Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39237 r39238  
     12008-12-12  Tor Arne Vestbø  <tavestbo@trolltech.com>
     2
     3        Rubber-stamped by Oliver Hunt.
     4
     5        Share PluginView::paintMissingPluginIcon() between ports
     6
     7        Also, enable this feature for Qt/X11, Qt/Mac and GTK
     8
     9        * plugins/PluginView.cpp:
     10        (WebCore::PluginView::paintMissingPluginIcon):
     11        * plugins/gtk/PluginViewGtk.cpp:
     12        (WebCore::PluginView::paint):
     13        * plugins/mac/PluginViewMac.cpp:
     14        (WebCore::PluginView::paint):
     15        * plugins/qt/PluginViewQt.cpp:
     16        (WebCore::PluginView::paint):
     17        * plugins/win/PluginViewWin.cpp:
     18
    1192008-12-12  Tor Arne Vestbø  <tavestbo@trolltech.com>
    220
  • trunk/WebCore/plugins/PluginView.cpp

    r39201 r39238  
    903903}
    904904
     905void PluginView::paintMissingPluginIcon(GraphicsContext* context, const IntRect& rect)
     906{
     907    static RefPtr<Image> nullPluginImage;
     908    if (!nullPluginImage)
     909        nullPluginImage = Image::loadPlatformResource("nullPlugin");
     910
     911    IntRect imageRect(frameRect().x(), frameRect().y(), nullPluginImage->width(), nullPluginImage->height());
     912
     913    int xOffset = (frameRect().width() - imageRect.width()) / 2;
     914    int yOffset = (frameRect().height() - imageRect.height()) / 2;
     915
     916    imageRect.move(xOffset, yOffset);
     917
     918    if (!rect.intersects(imageRect))
     919        return;
     920
     921    context->save();
     922    context->clip(windowClipRect());
     923    context->drawImage(nullPluginImage.get(), imageRect.location());
     924    context->restore();
     925}
     926
    905927} // namespace WebCore
  • trunk/WebCore/plugins/gtk/PluginViewGtk.cpp

    r39236 r39238  
    141141{
    142142    if (!m_isStarted) {
    143         // Draw the "missing plugin" image
    144         //paintMissingPluginIcon(context, rect);
     143        paintMissingPluginIcon(context, rect);
    145144        return;
    146145    }
  • trunk/WebCore/plugins/mac/PluginViewMac.cpp

    r39237 r39238  
    415415void PluginView::paint(GraphicsContext* context, const IntRect& rect)
    416416{
    417     if (!m_isStarted)
    418         return; // TODO: Draw the "missing plugin" image
     417    if (!m_isStarted) {
     418        paintMissingPluginIcon(context, rect);
     419        return;
     420    }
    419421
    420422    if (context->paintingDisabled())
  • trunk/WebCore/plugins/qt/PluginViewQt.cpp

    r39236 r39238  
    129129{
    130130    if (!m_isStarted) {
    131         // Draw the "missing plugin" image
    132         //paintMissingPluginIcon(context, rect);
     131        paintMissingPluginIcon(context, rect);
    133132        return;
    134133    }
  • trunk/WebCore/plugins/win/PluginViewWin.cpp

    r39236 r39238  
    283283}
    284284
    285 void PluginView::paintMissingPluginIcon(GraphicsContext* context, const IntRect& rect)
    286 {
    287     static RefPtr<Image> nullPluginImage;
    288     if (!nullPluginImage)
    289         nullPluginImage = Image::loadPlatformResource("nullPlugin");
    290 
    291     IntRect imageRect(frameRect().x(), frameRect().y(), nullPluginImage->width(), nullPluginImage->height());
    292 
    293     int xOffset = (frameRect().width() - imageRect.width()) / 2;
    294     int yOffset = (frameRect().height() - imageRect.height()) / 2;
    295 
    296     imageRect.move(xOffset, yOffset);
    297 
    298     if (!rect.intersects(imageRect))
    299         return;
    300 
    301     context->save();
    302     context->clip(windowClipRect());
    303     context->drawImage(nullPluginImage.get(), imageRect.location());
    304     context->restore();
    305 }
    306 
    307285bool PluginView::dispatchNPEvent(NPEvent& npEvent)
    308286{
Note: See TracChangeset for help on using the changeset viewer.