diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llwebbrowserctrl.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llwebbrowserctrl.cpp')
-rw-r--r-- | linden/indra/newview/llwebbrowserctrl.cpp | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp index 209af42..e9a7132 100644 --- a/linden/indra/newview/llwebbrowserctrl.cpp +++ b/linden/indra/newview/llwebbrowserctrl.cpp | |||
@@ -50,6 +50,8 @@ | |||
50 | // linden library includes | 50 | // linden library includes |
51 | #include "llfocusmgr.h" | 51 | #include "llfocusmgr.h" |
52 | 52 | ||
53 | extern BOOL gRestoreGL; | ||
54 | |||
53 | // Setting the mozilla buffer width to 2048 exactly doesn't work, since it pads its rowbytes a bit, pushing the texture width over 2048. | 55 | // Setting the mozilla buffer width to 2048 exactly doesn't work, since it pads its rowbytes a bit, pushing the texture width over 2048. |
54 | // 2000 should give enough headroom for any amount of padding it cares to add. | 56 | // 2000 should give enough headroom for any amount of padding it cares to add. |
55 | const S32 MAX_DIMENSION = 2000; | 57 | const S32 MAX_DIMENSION = 2000; |
@@ -73,7 +75,8 @@ LLWebBrowserCtrl::LLWebBrowserCtrl( const std::string& name, const LLRect& rect | |||
73 | mAlwaysRefresh( false ), | 75 | mAlwaysRefresh( false ), |
74 | mExternalUrl( "" ), | 76 | mExternalUrl( "" ), |
75 | mMediaSource( 0 ), | 77 | mMediaSource( 0 ), |
76 | mTakeFocusOnClick( true ) | 78 | mTakeFocusOnClick( true ), |
79 | mCurrentNavUrl( "about:blank" ) | ||
77 | { | 80 | { |
78 | S32 screen_width = mIgnoreUIScale ? | 81 | S32 screen_width = mIgnoreUIScale ? |
79 | llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); | 82 | llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); |
@@ -109,7 +112,7 @@ LLWebBrowserCtrl::LLWebBrowserCtrl( const std::string& name, const LLRect& rect | |||
109 | } | 112 | } |
110 | 113 | ||
111 | LLRect border_rect( 0, getRect().getHeight() + 2, getRect().getWidth() + 2, 0 ); | 114 | LLRect border_rect( 0, getRect().getHeight() + 2, getRect().getWidth() + 2, 0 ); |
112 | mBorder = new LLViewBorder( "web control border", border_rect, LLViewBorder::BEVEL_IN ); | 115 | mBorder = new LLViewBorder( std::string("web control border"), border_rect, LLViewBorder::BEVEL_IN ); |
113 | addChild( mBorder ); | 116 | addChild( mBorder ); |
114 | } | 117 | } |
115 | 118 | ||
@@ -230,7 +233,7 @@ BOOL LLWebBrowserCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) | |||
230 | } | 233 | } |
231 | } | 234 | } |
232 | 235 | ||
233 | gViewerWindow->setMouseCapture( NULL ); | 236 | gFocusMgr.setMouseCapture( NULL ); |
234 | 237 | ||
235 | return TRUE; | 238 | return TRUE; |
236 | } | 239 | } |
@@ -244,7 +247,7 @@ BOOL LLWebBrowserCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) | |||
244 | if (mMediaSource) | 247 | if (mMediaSource) |
245 | mMediaSource->mouseDown(x, y); | 248 | mMediaSource->mouseDown(x, y); |
246 | 249 | ||
247 | gViewerWindow->setMouseCapture( this ); | 250 | gFocusMgr.setMouseCapture( this ); |
248 | 251 | ||
249 | if (mTakeFocusOnClick) | 252 | if (mTakeFocusOnClick) |
250 | { | 253 | { |
@@ -263,7 +266,7 @@ BOOL LLWebBrowserCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) | |||
263 | if (mMediaSource) | 266 | if (mMediaSource) |
264 | mMediaSource->mouseLeftDoubleClick( x, y ); | 267 | mMediaSource->mouseLeftDoubleClick( x, y ); |
265 | 268 | ||
266 | gViewerWindow->setMouseCapture( this ); | 269 | gFocusMgr.setMouseCapture( this ); |
267 | 270 | ||
268 | if (mTakeFocusOnClick) | 271 | if (mTakeFocusOnClick) |
269 | { | 272 | { |
@@ -462,8 +465,8 @@ void LLWebBrowserCtrl::navigateTo( std::string urlIn ) | |||
462 | // don't browse to anything that starts with secondlife:// or sl:// | 465 | // don't browse to anything that starts with secondlife:// or sl:// |
463 | const std::string protocol1 = "secondlife://"; | 466 | const std::string protocol1 = "secondlife://"; |
464 | const std::string protocol2 = "sl://"; | 467 | const std::string protocol2 = "sl://"; |
465 | if ((LLString::compareInsensitive(urlIn.substr(0, protocol1.length()).c_str(), protocol1.c_str()) == 0) || | 468 | if ((LLStringUtil::compareInsensitive(urlIn.substr(0, protocol1.length()), protocol1) == 0) || |
466 | (LLString::compareInsensitive(urlIn.substr(0, protocol2.length()).c_str(), protocol2.c_str()) == 0)) | 469 | (LLStringUtil::compareInsensitive(urlIn.substr(0, protocol2.length()), protocol2) == 0)) |
467 | { | 470 | { |
468 | // TODO: Print out/log this attempt? | 471 | // TODO: Print out/log this attempt? |
469 | // llinfos << "Rejecting attempt to load restricted website :" << urlIn << llendl; | 472 | // llinfos << "Rejecting attempt to load restricted website :" << urlIn << llendl; |
@@ -471,7 +474,10 @@ void LLWebBrowserCtrl::navigateTo( std::string urlIn ) | |||
471 | } | 474 | } |
472 | 475 | ||
473 | if (mMediaSource) | 476 | if (mMediaSource) |
477 | { | ||
478 | mCurrentNavUrl = urlIn; | ||
474 | mMediaSource->navigateTo(urlIn); | 479 | mMediaSource->navigateTo(urlIn); |
480 | } | ||
475 | } | 481 | } |
476 | 482 | ||
477 | 483 | ||
@@ -553,6 +559,14 @@ void LLWebBrowserCtrl::draw() | |||
553 | if ( ! mWebBrowserImage ) | 559 | if ( ! mWebBrowserImage ) |
554 | return; | 560 | return; |
555 | 561 | ||
562 | if ( gRestoreGL == 1 ) | ||
563 | { | ||
564 | LLRect r = getRect(); | ||
565 | mMediaSource->updateMedia(); | ||
566 | reshape( r.getWidth(), r.getHeight(), FALSE ); | ||
567 | return; | ||
568 | }; | ||
569 | |||
556 | // NOTE: optimization needed here - probably only need to do this once | 570 | // NOTE: optimization needed here - probably only need to do this once |
557 | // unless tearoffs change the parent which they probably do. | 571 | // unless tearoffs change the parent which they probably do. |
558 | const LLUICtrl* ptr = findRootMostFocusRoot(); | 572 | const LLUICtrl* ptr = findRootMostFocusRoot(); |
@@ -721,8 +735,8 @@ void LLWebBrowserCtrl::onClickLinkHref( const EventType& eventIn ) | |||
721 | { | 735 | { |
722 | if ( eventIn.getStringValue().length() ) | 736 | if ( eventIn.getStringValue().length() ) |
723 | { | 737 | { |
724 | if ( LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol1.length() ).c_str(), protocol1.c_str() ) == 0 || | 738 | if ( LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol1.length() ), protocol1 ) == 0 || |
725 | LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ).c_str(), protocol2.c_str() ) == 0 ) | 739 | LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ), protocol2 ) == 0 ) |
726 | { | 740 | { |
727 | LLWeb::loadURLExternal( eventIn.getStringValue() ); | 741 | LLWeb::loadURLExternal( eventIn.getStringValue() ); |
728 | }; | 742 | }; |
@@ -733,8 +747,8 @@ void LLWebBrowserCtrl::onClickLinkHref( const EventType& eventIn ) | |||
733 | { | 747 | { |
734 | if ( eventIn.getStringValue().length() ) | 748 | if ( eventIn.getStringValue().length() ) |
735 | { | 749 | { |
736 | if ( LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol1.length() ).c_str(), protocol1.c_str() ) == 0 || | 750 | if ( LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol1.length() ), protocol1 ) == 0 || |
737 | LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ).c_str(), protocol2.c_str() ) == 0 ) | 751 | LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ), protocol2 ) == 0 ) |
738 | { | 752 | { |
739 | // If we spawn a new LLFloaterHTML, assume we want it to | 753 | // If we spawn a new LLFloaterHTML, assume we want it to |
740 | // follow this LLWebBrowserCtrl's setting for whether or | 754 | // follow this LLWebBrowserCtrl's setting for whether or |
@@ -922,6 +936,7 @@ void LLWebBrowserTexture::resize( S32 new_width, S32 new_height ) | |||
922 | // HACK - this code is executing a render - resize should call render() instead | 936 | // HACK - this code is executing a render - resize should call render() instead |
923 | // (and render() should be refactored so it doesn't call resize()) | 937 | // (and render() should be refactored so it doesn't call resize()) |
924 | 938 | ||
939 | mMediaSource->updateMedia(); | ||
925 | const unsigned char* pixels = mMediaSource->getMediaData(); | 940 | const unsigned char* pixels = mMediaSource->getMediaData(); |
926 | 941 | ||
927 | S32 media_width = mMediaSource->getMediaWidth(); | 942 | S32 media_width = mMediaSource->getMediaWidth(); |
@@ -1011,10 +1026,10 @@ void LLWebBrowserTexture::resize( S32 new_width, S32 new_height ) | |||
1011 | 1026 | ||
1012 | LLView* LLWebBrowserCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 1027 | LLView* LLWebBrowserCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
1013 | { | 1028 | { |
1014 | LLString name("web_browser"); | 1029 | std::string name("web_browser"); |
1015 | node->getAttributeString("name", name); | 1030 | node->getAttributeString("name", name); |
1016 | 1031 | ||
1017 | LLString start_url("start_url"); | 1032 | std::string start_url("start_url"); |
1018 | node->getAttributeString("start_url", start_url ); | 1033 | node->getAttributeString("start_url", start_url ); |
1019 | 1034 | ||
1020 | BOOL border_visible = true; | 1035 | BOOL border_visible = true; |
@@ -1048,4 +1063,8 @@ LLView* LLWebBrowserCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac | |||
1048 | return web_browser; | 1063 | return web_browser; |
1049 | } | 1064 | } |
1050 | 1065 | ||
1066 | std::string LLWebBrowserCtrl::getCurrentNavUrl() | ||
1067 | { | ||
1068 | return mCurrentNavUrl; | ||
1069 | } | ||
1051 | 1070 | ||