diff options
author | callum <none@none> | 2011-10-25 19:34:05 -0700 |
---|---|---|
committer | callum <none@none> | 2011-10-25 19:34:05 -0700 |
commit | 343562889e2b9332942f1c190e0dd6b7ddcb9540 (patch) | |
tree | 7daa6347a8c309559c4f7ecacf90fbd3948534f7 /indra | |
parent | 0ecc5c0878adf93e96b99e3db4c65cdb757b99fb (diff) |
EXP-1471 WIP Add support for zooming web pages by a scale facxtor
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 8 | ||||
-rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 1 | ||||
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llmediactrl.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 1 |
6 files changed, 44 insertions, 3 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index c53857fcee..dbd96673a1 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -1239,6 +1239,14 @@ void LLPluginClassMedia::focus(bool focused) sendMessage(message); } +void LLPluginClassMedia::set_page_zoom_factor( double factor ) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_page_zoom_factor"); + + message.setValueReal("factor", factor); + sendMessage(message); +} + void LLPluginClassMedia::clear_cache() { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "clear_cache"); diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 1f548f8cc0..d95fa40091 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -202,6 +202,7 @@ public: bool pluginSupportsMediaBrowser(void); void focus(bool focused); + void set_page_zoom_factor( double factor ); void clear_cache(); void clear_cookies(); void set_cookies(const std::string &cookies); diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 0f74772e42..d35d202e99 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -323,7 +323,7 @@ private: LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled ); // turn on/off Javascript based on what host app tells us - LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); + LLQtWebKit::getInstance()->enableJavaScript( mJavascriptEnabled ); std::stringstream str; str << "Cookies enabled = " << mCookiesEnabled << ", plugins enabled = " << mPluginsEnabled << ", Javascript enabled = " << mJavascriptEnabled; @@ -346,7 +346,7 @@ private: // append details to agent string LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); postDebugMessage( "Updating user agent with " + mUserAgent ); - + #if !LL_QTWEBKIT_USES_PIXMAPS // don't flip bitmap LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true ); @@ -1298,6 +1298,15 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) mFirstFocus = false; } } + else if(message_name == "set_page_zoom_factor") + { +#if LLQTWEBKIT_API_VERSION >= 15 + F32 factor = message_in.getValueReal("factor"); + LLQtWebKit::getInstance()->setPageZoomFactor(factor); +#else + llwarns << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << llendl; +#endif + } else if(message_name == "clear_cache") { LLQtWebKit::getInstance()->clearCache(); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 0bdeb114f5..dd12546bc6 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -113,7 +113,7 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : } setIgnoreUIScale(p.ignore_ui_scale); - + setHomePageUrl(p.start_url, p.initial_mime_type); setBorderVisible(p.border_visible); @@ -779,6 +779,18 @@ void LLMediaCtrl::draw() floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), LLFontGL::sCurOrigin.mZ); } + else + { + // zoom is an expensive operation - only do it if value changes + // TODO: move this logic out to mMediaSource->setPageZoomFactor() ?? + static double prev_ui_scale = 0.0f; + double ui_scale = LLUI::sGLScaleFactor.mV[ VX ]; + if ( ui_scale != prev_ui_scale ) + { + mMediaSource->setPageZoomFactor( ui_scale ); + prev_ui_scale = ui_scale; + } + } // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 13dbc5e386..fdb281b7f1 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2301,6 +2301,16 @@ void LLViewerMediaImpl::clearCache() } } + +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::setPageZoomFactor( double factor ) +{ + if(mMediaSource) + { + mMediaSource->set_page_zoom_factor( factor ); + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button) { diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 0b69b8f0c1..a475d03542 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -250,6 +250,7 @@ public: std::string getMediaEntryURL() { return mMediaEntryURL; } void setHomeURL(const std::string& home_url, const std::string& mime_type = LLStringUtil::null) { mHomeURL = home_url; mHomeMimeType = mime_type;}; void clearCache(); + void setPageZoomFactor( double factor ); std::string getMimeType() { return mMimeType; } void scaleMouse(S32 *mouse_x, S32 *mouse_y); void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); |