diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 12 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 2 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 47 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.h | 7 |
4 files changed, 58 insertions, 10 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 77a4b08af5..a1e1f75367 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -1641,3 +1641,15 @@ void LLPluginClassMedia::initializeUrlHistory(const LLSD& url_history) LL_DEBUGS("Plugin") << "Sending history" << LL_ENDL; } + +void LLPluginClassMedia::forceRenderRefresh() +{ + // Force layout recalculation by briefly hiding/showing the web content + // Used to clear black screen issues after resize, see #5607 + const std::string refresh_script = + "document.documentElement.style.visibility='hidden';" + "document.documentElement.offsetHeight;" + "document.documentElement.style.visibility='';"; + + executeJavaScript(refresh_script); +} diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 71522bcd7d..40f6295e55 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -350,6 +350,8 @@ public: std::shared_ptr<LLPluginClassMedia> getSharedPtr() { return std::dynamic_pointer_cast<LLPluginClassMedia>(shared_from_this()); } // due to enable_shared_from_this + void forceRenderRefresh(); + protected: LLPluginClassMediaOwner *mOwner; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index f100fb8c1a..d629d33e43 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -48,6 +48,7 @@ #include "llstartup.h" #include "lltextbox.h" #include "llui.h" +#include "llframetimer.h" #include "lluiconstants.h" #include "llslurl.h" #include "llversioninfo.h" @@ -314,8 +315,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, forgot_password_text->setClickedCallback(onClickForgotPassword, NULL); // get the web browser control - LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); - web_browser->addObserver(this); + mWebBrowser = getChild<LLMediaCtrl>("login_html"); + mWebBrowser->addObserver(this); loadLoginPage(); @@ -850,11 +851,9 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh) { if (sInstance && LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) { - LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html"); - - if (web_browser) + if (sInstance->mWebBrowser) { - web_browser->setAlwaysRefresh(refresh); + sInstance->mWebBrowser->setAlwaysRefresh(refresh); } } } @@ -911,16 +910,28 @@ void LLPanelLogin::loadLoginPage() gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid()); - LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html"); - if (web_browser->getCurrentNavUrl() != login_uri.asString()) + if (sInstance->mWebBrowser->getCurrentNavUrl() != login_uri.asString()) { LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL; - web_browser->navigateTo( login_uri.asString(), "text/html" ); + sInstance->mWebBrowser->navigateTo(login_uri.asString(), "text/html"); } } -void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent event) +void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) { + constexpr F32 REFRESH_DELAY = 2.f; + switch (event) + { + case MEDIA_EVENT_SIZE_CHANGED: + { + mForceRefreshTimer.reset(); + mForceRefreshTimer.setTimerExpirySec(REFRESH_DELAY); + mForceRefresh = true; + break; + } + default: + break; + } } //--------------------------------------------------------------------------- @@ -1383,3 +1394,19 @@ void LLPanelLogin::collapseGridPanel(bool collapse) mLoginStack->collapsePanel(mGridPanel, collapse); mLoginStack->updateLayout(); } + +void LLPanelLogin::draw() +{ + LLPanel::draw(); + + // Workaround for the black screen issue (see #5607) + // Should be removed after the proper fix for resizing is implemented + if (mForceRefresh && mForceRefreshTimer.hasExpired()) + { + if (mWebBrowser->getMediaPlugin()) + { + mWebBrowser->getMediaPlugin()->forceRenderRefresh(); + } + mForceRefresh = false; + } +} diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index f7104a94b1..a00081795e 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -48,6 +48,8 @@ public: void *callback_data); ~LLPanelLogin(); + void draw(); + virtual void setFocus( bool b ); static void show(const LLRect &rect, @@ -131,10 +133,15 @@ private: unsigned int mPasswordLength; unsigned int mLocationLength; + LLTimer mForceRefreshTimer; + bool mForceRefresh {false}; + bool mAlertNotif; LLButton* mLoginBtn; LLLayoutPanel* mGridPanel; LLLayoutStack* mLoginStack; + + LLMediaCtrl* mWebBrowser; }; #endif |
