Title: [88816] trunk/Source/WebCore
- Revision
- 88816
- Author
- [email protected]
- Date
- 2011-06-14 10:13:03 -0700 (Tue, 14 Jun 2011)
Log Message
2011-06-14 Viatcheslav Ostapenko <[email protected]>
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (88815 => 88816)
--- trunk/Source/WebCore/ChangeLog 2011-06-14 17:03:38 UTC (rev 88815)
+++ trunk/Source/WebCore/ChangeLog 2011-06-14 17:13:03 UTC (rev 88816)
@@ -1,3 +1,26 @@
+2011-06-14 Viatcheslav Ostapenko <[email protected]>
+
+ 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):
+
2011-06-14 Sreeram Ramachandran <[email protected]>
Reviewed by Pavel Feldman.
Modified: trunk/Source/WebCore/plugins/PluginView.h (88815 => 88816)
--- trunk/Source/WebCore/plugins/PluginView.h 2011-06-14 17:03:38 UTC (rev 88815)
+++ trunk/Source/WebCore/plugins/PluginView.h 2011-06-14 17:13:03 UTC (rev 88816)
@@ -68,6 +68,11 @@
class QPainter;
QT_END_NAMESPACE
#endif
+#if PLATFORM(QT) && USE(ACCELERATED_COMPOSITING) && ENABLE(NETSCAPE_PLUGIN_API) && (defined(XP_UNIX) || OS(SYMBIAN))
+#ifndef WTF_USE_ACCELERATED_COMPOSITING_PLUGIN_LAYER
+#define WTF_USE_ACCELERATED_COMPOSITING_PLUGIN_LAYER 1
+#endif
+#endif
#if PLATFORM(GTK)
typedef struct _GtkSocket GtkSocket;
#endif
@@ -259,8 +264,9 @@
void keepAlive();
#if USE(ACCELERATED_COMPOSITING)
-#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) && PLATFORM(QT)
+#if USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)
virtual PlatformLayer* platformLayer() const;
+ bool shouldUseAcceleratedCompositing() const;
#else
virtual PlatformLayer* platformLayer() const { return 0; }
#endif
@@ -432,11 +438,11 @@
#endif
#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
void paintUsingXPixmap(QPainter* painter, const QRect &exposedRect);
-#if USE(ACCELERATED_COMPOSITING)
+#endif
+#if USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)
OwnPtr<PlatformLayer> m_platformLayer;
friend class PluginGraphicsLayerQt;
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif
+#endif // USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)
#endif // PLATFORM(QT)
#if PLATFORM(GTK)
Modified: trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp (88815 => 88816)
--- trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp 2011-06-14 17:03:38 UTC (rev 88815)
+++ trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp 2011-06-14 17:13:03 UTC (rev 88816)
@@ -120,6 +120,13 @@
private:
PluginView* m_view;
};
+
+bool PluginView::shouldUseAcceleratedCompositing() const
+{
+ return m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
+ && m_parentFrame->page()->settings()
+ && m_parentFrame->page()->settings()->acceleratedCompositingEnabled();
+}
#endif
void PluginView::updatePluginWidget()
@@ -959,9 +966,7 @@
m_pluginDisplay = getPluginDisplay();
#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
- if (m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
- && m_parentFrame->page()->settings()
- && m_parentFrame->page()->settings()->acceleratedCompositingEnabled()) {
+ if (shouldUseAcceleratedCompositing()) {
m_platformLayer = adoptPtr(new PluginGraphicsLayerQt(this));
// Trigger layer computation in RenderLayerCompositor
m_element->setNeedsStyleRecalc(SyntheticStyleChange);
Modified: trunk/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp (88815 => 88816)
--- trunk/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp 2011-06-14 17:03:38 UTC (rev 88815)
+++ trunk/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp 2011-06-14 17:13:03 UTC (rev 88816)
@@ -20,6 +20,8 @@
#include "PluginView.h"
#include "BridgeJSC.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
#include "Document.h"
#include "DocumentLoader.h"
#include "Element.h"
@@ -59,6 +61,7 @@
#include <QKeyEvent>
#include <QPixmap>
#include <QRegion>
+#include <QStyleOptionGraphicsItem>
#include <QVector>
#include <QWidget>
#include <runtime/JSLock.h>
@@ -85,6 +88,49 @@
using namespace HTMLNames;
+#if USE(ACCELERATED_COMPOSITING)
+class PluginGraphicsLayerQt : public QGraphicsWidget {
+public:
+ PluginGraphicsLayerQt(PluginView* view) : m_view(view)
+ {
+ setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
+ }
+
+ ~PluginGraphicsLayerQt() { }
+
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0)
+ {
+ Q_UNUSED(widget);
+
+ m_view->m_npWindow.ws_info = (void*)(painter);
+ m_view->setNPWindowIfNeeded();
+
+ painter->save();
+ QRectF clipRect(QPointF(0, 0), QSizeF(m_view->frameRect().size()));
+ if (option && !option->exposedRect.isEmpty())
+ clipRect &= option->exposedRect;
+ painter->setClipRect(clipRect);
+
+ QRect rect = clipRect.toRect();
+ QPaintEvent ev(rect);
+ QEvent& npEvent = ev;
+ m_view->dispatchNPEvent(npEvent);
+
+ painter->restore();
+ }
+
+private:
+ PluginView* m_view;
+};
+
+bool PluginView::shouldUseAcceleratedCompositing() const
+{
+ return m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
+ && m_parentFrame->page()->settings()
+ && m_parentFrame->page()->settings()->acceleratedCompositingEnabled();
+}
+#endif
+
void PluginView::updatePluginWidget()
{
if (!parent())
@@ -148,6 +194,11 @@
if (m_isWindowed)
return;
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_platformLayer)
+ return;
+#endif
+
context->save();
IntRect clipRect(rect);
clipRect.intersect(frameRect());
@@ -344,6 +395,13 @@
void PluginView::invalidateRect(const IntRect& rect)
{
+#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
+ if (m_platformLayer) {
+ m_platformLayer->update(QRectF(rect));
+ return;
+ }
+#endif
+
if (m_isWindowed) {
platformWidget()->update(rect);
return;
@@ -415,6 +473,12 @@
setPlatformWidget(0);
m_npWindow.type = NPWindowTypeDrawable;
m_npWindow.window = 0; // Not used?
+#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
+ if (shouldUseAcceleratedCompositing()) {
+ m_platformLayer = new PluginGraphicsLayerQt(this);
+ m_element->setNeedsStyleRecalc(SyntheticStyleChange);
+ }
+#endif
}
updatePluginWidget();
setNPWindowIfNeeded();
@@ -444,4 +508,11 @@
{
}
+#if USE(ACCELERATED_COMPOSITING)
+PlatformLayer* PluginView::platformLayer() const
+{
+ return m_platformLayer.get();
+}
+#endif
+
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes