Changeset 88816 in webkit


Ignore:
Timestamp:
Jun 14, 2011 10:13:03 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-06-14 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] [Symbian] GraphicsLayer: support plugins on symbian
https://bugs.webkit.org/show_bug.cgi?id=57418

Implement graphics layer for plugins on Symbian.

  • plugins/PluginView.h:
  • plugins/qt/PluginViewQt.cpp: (WebCore::PluginView::shouldUseAcceleratedCompositing): (WebCore::PluginView::platformStart):
  • plugins/symbian/PluginViewSymbian.cpp: (WebCore::PluginGraphicsLayerQt::PluginGraphicsLayerQt): (WebCore::PluginGraphicsLayerQt::~PluginGraphicsLayerQt): (WebCore::PluginGraphicsLayerQt::paint): (WebCore::PluginView::shouldUseAcceleratedCompositing): (WebCore::PluginView::paint): (WebCore::PluginView::invalidateRect): (WebCore::PluginView::platformStart): (WebCore::PluginView::platformLayer):
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88815 r88816  
     12011-06-14  Viatcheslav Ostapenko  <ostapenko.viatcheslav@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] [Symbian] GraphicsLayer: support plugins on symbian
     6        https://bugs.webkit.org/show_bug.cgi?id=57418
     7
     8        Implement graphics layer for plugins on Symbian.
     9
     10        * plugins/PluginView.h:
     11        * plugins/qt/PluginViewQt.cpp:
     12        (WebCore::PluginView::shouldUseAcceleratedCompositing):
     13        (WebCore::PluginView::platformStart):
     14        * plugins/symbian/PluginViewSymbian.cpp:
     15        (WebCore::PluginGraphicsLayerQt::PluginGraphicsLayerQt):
     16        (WebCore::PluginGraphicsLayerQt::~PluginGraphicsLayerQt):
     17        (WebCore::PluginGraphicsLayerQt::paint):
     18        (WebCore::PluginView::shouldUseAcceleratedCompositing):
     19        (WebCore::PluginView::paint):
     20        (WebCore::PluginView::invalidateRect):
     21        (WebCore::PluginView::platformStart):
     22        (WebCore::PluginView::platformLayer):
     23
    1242011-06-14  Sreeram Ramachandran  <sreeram@chromium.org>
    225
  • trunk/Source/WebCore/plugins/PluginView.h

    r86276 r88816  
    6969QT_END_NAMESPACE
    7070#endif
     71#if PLATFORM(QT) && USE(ACCELERATED_COMPOSITING) && ENABLE(NETSCAPE_PLUGIN_API) && (defined(XP_UNIX) || OS(SYMBIAN))
     72#ifndef WTF_USE_ACCELERATED_COMPOSITING_PLUGIN_LAYER
     73#define WTF_USE_ACCELERATED_COMPOSITING_PLUGIN_LAYER 1
     74#endif
     75#endif
    7176#if PLATFORM(GTK)
    7277typedef struct _GtkSocket GtkSocket;
     
    260265
    261266#if USE(ACCELERATED_COMPOSITING)
    262 #if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) && PLATFORM(QT)
     267#if USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)
    263268        virtual PlatformLayer* platformLayer() const;
     269        bool shouldUseAcceleratedCompositing() const;
    264270#else
    265271        virtual PlatformLayer* platformLayer() const { return 0; }
     
    433439#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
    434440        void paintUsingXPixmap(QPainter* painter, const QRect &exposedRect);
    435 #if USE(ACCELERATED_COMPOSITING)
     441#endif
     442#if USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)
    436443        OwnPtr<PlatformLayer> m_platformLayer;
    437444        friend class PluginGraphicsLayerQt;
    438 #endif // USE(ACCELERATED_COMPOSITING)
    439 #endif
     445#endif // USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)
    440446#endif // PLATFORM(QT)
    441447
  • trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp

    r87429 r88816  
    121121    PluginView* m_view;
    122122};
     123
     124bool PluginView::shouldUseAcceleratedCompositing() const
     125{
     126    return m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
     127           && m_parentFrame->page()->settings()
     128           && m_parentFrame->page()->settings()->acceleratedCompositingEnabled();
     129}
    123130#endif
    124131
     
    960967
    961968#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
    962         if (m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
    963             && m_parentFrame->page()->settings()
    964             && m_parentFrame->page()->settings()->acceleratedCompositingEnabled()) {
     969        if (shouldUseAcceleratedCompositing()) {
    965970            m_platformLayer = adoptPtr(new PluginGraphicsLayerQt(this));
    966971            // Trigger layer computation in RenderLayerCompositor
  • trunk/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp

    r84371 r88816  
    2121
    2222#include "BridgeJSC.h"
     23#include "Chrome.h"
     24#include "ChromeClient.h"
    2325#include "Document.h"
    2426#include "DocumentLoader.h"
     
    6062#include <QPixmap>
    6163#include <QRegion>
     64#include <QStyleOptionGraphicsItem>
    6265#include <QVector>
    6366#include <QWidget>
     
    8689using namespace HTMLNames;
    8790
     91#if USE(ACCELERATED_COMPOSITING)
     92class PluginGraphicsLayerQt : public QGraphicsWidget {
     93public:
     94    PluginGraphicsLayerQt(PluginView* view) : m_view(view)
     95    {
     96        setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
     97    }
     98
     99    ~PluginGraphicsLayerQt() { }
     100
     101    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0)
     102    {
     103        Q_UNUSED(widget);
     104
     105        m_view->m_npWindow.ws_info = (void*)(painter);
     106        m_view->setNPWindowIfNeeded();
     107
     108        painter->save();
     109        QRectF clipRect(QPointF(0, 0), QSizeF(m_view->frameRect().size()));
     110        if (option && !option->exposedRect.isEmpty())
     111            clipRect &= option->exposedRect;
     112        painter->setClipRect(clipRect);
     113
     114        QRect rect = clipRect.toRect();
     115        QPaintEvent ev(rect);
     116        QEvent& npEvent = ev;
     117        m_view->dispatchNPEvent(npEvent);
     118
     119        painter->restore();
     120    }
     121
     122private:
     123    PluginView* m_view;
     124};
     125
     126bool PluginView::shouldUseAcceleratedCompositing() const
     127{
     128    return m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
     129           && m_parentFrame->page()->settings()
     130           && m_parentFrame->page()->settings()->acceleratedCompositingEnabled();
     131}
     132#endif
     133
    88134void PluginView::updatePluginWidget()
    89135{
     
    148194    if (m_isWindowed)
    149195        return;
     196
     197#if USE(ACCELERATED_COMPOSITING)
     198    if (m_platformLayer)
     199        return;
     200#endif
    150201
    151202    context->save();
     
    345396void PluginView::invalidateRect(const IntRect& rect)
    346397{
     398#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
     399    if (m_platformLayer) {
     400        m_platformLayer->update(QRectF(rect));
     401        return;
     402    }
     403#endif
     404
    347405    if (m_isWindowed) {
    348406        platformWidget()->update(rect);
     
    416474        m_npWindow.type = NPWindowTypeDrawable;
    417475        m_npWindow.window = 0; // Not used?
     476#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
     477        if (shouldUseAcceleratedCompositing()) {
     478            m_platformLayer = new PluginGraphicsLayerQt(this);
     479            m_element->setNeedsStyleRecalc(SyntheticStyleChange);
     480        }
     481#endif
    418482    }   
    419483    updatePluginWidget();
     
    445509}
    446510
     511#if USE(ACCELERATED_COMPOSITING)
     512PlatformLayer* PluginView::platformLayer() const
     513{
     514    return m_platformLayer.get();
     515}
     516#endif
     517
    447518} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.