diff options
author | Michael Bruning <michael.bruning@theqtcompany.com> | 2015-02-23 16:20:37 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@theqtcompany.com> | 2015-02-26 11:43:32 +0000 |
commit | 67aba37ab361fc117366e283365920013b8d8464 (patch) | |
tree | 61a15569cb95ca754a17399cf0a557c621d83951 /Source/WebCore | |
parent | 877fe7d55036492a897d0928fe43d5df2bc6e2e5 (diff) | |
download | qtwebkit-67aba37ab361fc117366e283365920013b8d8464.tar.gz |
Forward show and hide events to PluginViews
This was causing issues with windows plugins on windows, which were
always visible on top of all other widgets and not hidden correctly
when the owning web view was hidden.
Task-number: QTBUG-44401
Task-number: QTBUG-42588
Task-number: QTBUG-43024
Change-Id: Ie0307fa2f7b2bf59f51a76db5feef2e8446c359d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/page/Page.cpp | 15 | ||||
-rw-r--r-- | Source/WebCore/page/Page.h | 4 | ||||
-rw-r--r-- | Source/WebCore/platform/qt/QWebPageClient.h | 1 | ||||
-rw-r--r-- | Source/WebCore/plugins/win/PluginViewWin.cpp | 23 |
4 files changed, 38 insertions, 5 deletions
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index b4c963a4f..5319f8e0c 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -1242,6 +1242,21 @@ void Page::privateBrowsingStateChanged() pluginViewBases[i]->privateBrowsingStateChanged(privateBrowsingEnabled); } +#if PLATFORM(QT) +void Page::pluginVisibilityChanged(bool visible) +{ + Vector<RefPtr<PluginViewBase>, 32> pluginViewBases; + collectPluginViews(pluginViewBases); + + for (size_t i = 0; i < pluginViewBases.size(); ++i) { + if (visible) + pluginViewBases[i]->show(); + else + pluginViewBases[i]->hide(); + } +} +#endif // PLATFORM(QT) + #if !ASSERT_DISABLED void Page::checkSubframeCountConsistency() const { diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h index d95565ab9..0931ed7b8 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h @@ -353,6 +353,10 @@ public: void setVisibilityState(PageVisibilityState, bool); #endif +#if PLATFORM(QT) + void pluginVisibilityChanged(bool visible); +#endif // PLATFORM(QT) + void addLayoutMilestones(LayoutMilestones); void removeLayoutMilestones(LayoutMilestones); LayoutMilestones requestedLayoutMilestones() const { return m_requestedLayoutMilestones; } diff --git a/Source/WebCore/platform/qt/QWebPageClient.h b/Source/WebCore/platform/qt/QWebPageClient.h index d07907287..71ba34a19 100644 --- a/Source/WebCore/platform/qt/QWebPageClient.h +++ b/Source/WebCore/platform/qt/QWebPageClient.h @@ -62,6 +62,7 @@ public: virtual QOpenGLContext* openGLContextIfAvailable() { return 0; } virtual void setInputMethodHints(Qt::InputMethodHints hint) = 0; + virtual bool isViewVisible() = 0; #ifndef QT_NO_CURSOR inline void resetCursor() diff --git a/Source/WebCore/plugins/win/PluginViewWin.cpp b/Source/WebCore/plugins/win/PluginViewWin.cpp index 3fa897db8..b225673ab 100644 --- a/Source/WebCore/plugins/win/PluginViewWin.cpp +++ b/Source/WebCore/plugins/win/PluginViewWin.cpp @@ -345,6 +345,17 @@ static bool isWindowsMessageUserGesture(UINT message) } } +static inline bool isWebViewVisible(FrameView* view) +{ +#if PLATFORM(QT) + if (PlatformPageClient client = view->hostWindow()->platformPageClient()) + return client->isViewVisible(); + return false; +#else + return true; +#endif // PLATFORM(QT) +} + static inline IntPoint contentsToNativeWindow(FrameView* view, const IntPoint& point) { #if PLATFORM(QT) @@ -511,9 +522,10 @@ void PluginView::show() { setSelfVisible(true); - if (isParentVisible() && platformPluginWidget()) + if (isParentVisible() && platformPluginWidget()) { ShowWindow(platformPluginWidget(), SW_SHOWNA); - + forceRedraw(); + } Widget::show(); } @@ -819,9 +831,10 @@ void PluginView::setParentVisible(bool visible) Widget::setParentVisible(visible); if (isSelfVisible() && platformPluginWidget()) { - if (visible) + if (visible) { ShowWindow(platformPluginWidget(), SW_SHOWNA); - else + forceRedraw(); + } else ShowWindow(platformPluginWidget(), SW_HIDE); } } @@ -1019,7 +1032,7 @@ bool PluginView::platformStart() #endif DWORD flags = WS_CHILD; - if (isSelfVisible()) + if (isSelfVisible() && isWebViewVisible(toFrameView(parent()))) flags |= WS_VISIBLE; HWND parentWindowHandle = windowHandleForPageClient(m_parentFrame->view()->hostWindow()->platformPageClient()); |