Title: [102923] trunk/Source
Revision
102923
Author
[email protected]
Date
2011-12-15 04:40:47 -0800 (Thu, 15 Dec 2011)

Log Message

[Qt] Get rid of layering violation in PluginViewQt

PluginViewQt has a layering violation in relying on QWebPagePrivate for
the check if running under DRT. We remove this and add a specific flag
in the PluginView for this check, enabled from DRTSupport. This isn't
pretty, but an improvement over what's currently there.

Reviewed by Simon Hausmann.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102922 => 102923)


--- trunk/Source/WebCore/ChangeLog	2011-12-15 12:38:42 UTC (rev 102922)
+++ trunk/Source/WebCore/ChangeLog	2011-12-15 12:40:47 UTC (rev 102923)
@@ -1,3 +1,19 @@
+2011-12-14  Tor Arne Vestbø  <[email protected]>
+
+        [Qt] Get rid of layering violation in PluginViewQt
+
+        PluginViewQt has a layering violation in relying on QWebPagePrivate for
+        the check if running under DRT. We remove this and add a specific flag
+        in the PluginView for this check, enabled from DRTSupport. This isn't
+        pretty, but an improvement over what's currently there.
+
+        Reviewed by Simon Hausmann.
+
+        * plugins/PluginView.h:
+        * plugins/qt/PluginViewQt.cpp:
+        (WebCore::PluginView::updatePluginWidget):
+        (WebCore::setXKeyEventSpecificFields):
+
 2011-12-14  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Console should show network messages origins.

Modified: trunk/Source/WebCore/plugins/PluginView.h (102922 => 102923)


--- trunk/Source/WebCore/plugins/PluginView.h	2011-12-15 12:38:42 UTC (rev 102922)
+++ trunk/Source/WebCore/plugins/PluginView.h	2011-12-15 12:40:47 UTC (rev 102923)
@@ -260,6 +260,11 @@
 #endif
 #endif
 
+#if PLATFORM(QT) && ENABLE(NETSCAPE_PLUGIN_API) && defined(XP_UNIX)
+        // PluginViewQt (X11) needs a few workarounds when running under DRT
+        static void setIsRunningUnderDRT(bool flag) { s_isRunningUnderDRT = flag; }
+#endif
+
     private:
         PluginView(Frame* parentFrame, const IntSize&, PluginPackage*, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
 
@@ -418,8 +423,10 @@
         void initXEvent(XEvent* event);
 #endif
 
-#if PLATFORM(QT) 
+#if PLATFORM(QT)
 #if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
+        static bool s_isRunningUnderDRT;
+        static void setXKeyEventSpecificFields(XEvent*, KeyboardEvent*);
         void paintUsingXPixmap(QPainter* painter, const QRect &exposedRect);
 #endif
 #if USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER)

Modified: trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp (102922 => 102923)


--- trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp	2011-12-15 12:38:42 UTC (rev 102922)
+++ trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp	2011-12-15 12:40:47 UTC (rev 102923)
@@ -66,7 +66,6 @@
 #include "RenderLayer.h"
 #include "Settings.h"
 #include "npruntime_impl.h"
-#include "qwebpage_p.h"
 #if USE(JSC)
 #include "runtime_root.h"
 #endif
@@ -102,6 +101,8 @@
 
 namespace WebCore {
 
+bool PluginView::s_isRunningUnderDRT = false;
+
 using namespace HTMLNames;
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -171,7 +172,7 @@
     // (ii) if we are running layout tests from DRT, paint() won't ever get called
     // so we need to call setNPWindowIfNeeded() if window geometry has changed
     if (!m_windowRect.intersects(frameView->frameRect())
-        || (QWebPagePrivate::drtRun && platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect)))
+        || (s_isRunningUnderDRT && platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect)))
         setNPWindowIfNeeded();
 
     if (!m_platformLayer) {
@@ -350,7 +351,7 @@
     setSharedXEventFields(xEvent, ownerWidget);
 }
 
-void setXKeyEventSpecificFields(XEvent* xEvent, KeyboardEvent* event)
+void PluginView::setXKeyEventSpecificFields(XEvent* xEvent, KeyboardEvent* event)
 {
     const PlatformKeyboardEvent* keyEvent = event->keyEvent();
 
@@ -365,7 +366,7 @@
     // case fetch the XEvent's keycode from the event's text. The only
     // place this keycode will be used is in webkit_test_plugin_handle_event().
     // FIXME: Create Qt API so that we can set the appropriate keycode in DRT EventSender instead.
-    if (QWebPagePrivate::drtRun && !xEvent->xkey.keycode) {
+    if (s_isRunningUnderDRT && !xEvent->xkey.keycode) {
         QKeyEvent* qKeyEvent = keyEvent->qtEvent();
         ASSERT(qKeyEvent);
         QString keyText = qKeyEvent->text().left(1);

Modified: trunk/Source/WebKit/qt/ChangeLog (102922 => 102923)


--- trunk/Source/WebKit/qt/ChangeLog	2011-12-15 12:38:42 UTC (rev 102922)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-12-15 12:40:47 UTC (rev 102923)
@@ -1,3 +1,17 @@
+2011-12-14  Tor Arne Vestbø  <[email protected]>
+
+        [Qt] Get rid of layering violation in PluginViewQt
+
+        PluginViewQt has a layering violation in relying on QWebPagePrivate for
+        the check if running under DRT. We remove this and add a specific flag
+        in the PluginView for this check, enabled from DRTSupport. This isn't
+        pretty, but an improvement over what's currently there.
+
+        Reviewed by Simon Hausmann.
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled):
+
 2011-12-15  Michael Brüning  <[email protected]>
 
         [QT][WK2]Add (experimental) viewport info view to Minibrowser/qt.

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp (102922 => 102923)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2011-12-15 12:38:42 UTC (rev 102922)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2011-12-15 12:40:47 UTC (rev 102923)
@@ -66,6 +66,7 @@
 #include "Page.h"
 #include "PageGroup.h"
 #include "PluginDatabase.h"
+#include "PluginView.h"
 #include "PositionError.h"
 #include "PrintContext.h"
 #include "RenderListItem.h"
@@ -235,6 +236,10 @@
 void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b)
 {
     QWebPagePrivate::drtRun = b;
+#if ENABLE(NETSCAPE_PLUGIN_API) && defined(XP_UNIX)
+    // PluginViewQt (X11) needs a few workarounds when running under DRT
+    PluginView::setIsRunningUnderDRT(b);
+#endif
 }
 
 void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to