summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2010-05-26 16:24:49 -0700
committerLeyla Farazha <leyla@lindenlab.com>2010-05-26 16:24:49 -0700
commitc5c13a92eb62e1e9927a9685d5433c040e6ef2ce (patch)
tree0134513ccbd15cccd193bc38772eb5147e0f4591 /indra/llui
parentabcdff128c85c5a1188da8e36510f249e5918899 (diff)
parentdb119d86a7a930c64b022c41386d37c001555d68 (diff)
Merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llstyle.cpp6
-rw-r--r--indra/llui/llstyle.h2
-rw-r--r--indra/llui/lltextbase.cpp13
-rw-r--r--indra/llui/lltextbase.h1
-rw-r--r--indra/llui/llurlentry.cpp39
-rw-r--r--indra/llui/llurlentry.h2
-rw-r--r--indra/llui/llurlmatch.h2
-rw-r--r--indra/llui/llview.cpp2
-rw-r--r--indra/llui/tests/llurlentry_test.cpp21
-rw-r--r--indra/llui/tests/llurlmatch_test.cpp24
10 files changed, 73 insertions, 39 deletions
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp
index b8f93b6a0e..5965ca6fb5 100644
--- a/indra/llui/llstyle.cpp
+++ b/indra/llui/llstyle.cpp
@@ -44,7 +44,8 @@ LLStyle::Params::Params()
color("color", LLColor4::black),
font("font", LLFontGL::getFontMonospace()),
image("image"),
- link_href("href")
+ link_href("href"),
+ is_link("is_link")
{}
@@ -57,6 +58,7 @@ LLStyle::LLStyle(const LLStyle::Params& p)
mReadOnlyColor(p.readonly_color()),
mFont(p.font()),
mLink(p.link_href),
+ mIsLink(p.is_link.isProvided() ? p.is_link : !p.link_href().empty()),
mDropShadow(p.drop_shadow),
mImagep(p.image())
{}
@@ -79,7 +81,7 @@ void LLStyle::setLinkHREF(const std::string& href)
BOOL LLStyle::isLink() const
{
- return mLink.size();
+ return mIsLink;
}
BOOL LLStyle::isVisible() const
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index 2067e8e8be..0ca1f2027e 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -51,6 +51,7 @@ public:
Optional<const LLFontGL*> font;
Optional<LLUIImage*> image;
Optional<std::string> link_href;
+ Optional<bool> is_link;
Params();
};
LLStyle(const Params& p = Params());
@@ -113,6 +114,7 @@ private:
std::string mFontName;
const LLFontGL* mFont; // cached for performance
std::string mLink;
+ bool mIsLink;
LLUIImagePtr mImagep;
};
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 9a07712757..8fc6f16702 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1116,8 +1116,19 @@ void LLTextBase::reflow()
updateSegments();
+ S32 reflow_count = 0;
while(mReflowIndex < S32_MAX)
{
+ // we can get into an infinite loop if the document height does not monotonically increase
+ // with decreasing width (embedded ui elements with alternate layouts). In that case,
+ // we want to stop reflowing after 2 iterations. We use 2, since we need to handle the case
+ // of introducing a vertical scrollbar causing a reflow with less width. We should also always
+ // use an even number of iterations to avoid user visible oscillation of the layout
+ if(++reflow_count > 2)
+ {
+ lldebugs << "Breaking out of reflow due to possible infinite loop in " << getName() << llendl;
+ break;
+ }
S32 start_index = mReflowIndex;
mReflowIndex = S32_MAX;
@@ -1783,7 +1794,7 @@ void LLTextBase::replaceUrl(const std::string &url,
seg->setEnd(seg_start + seg_length);
// if we find a link with our Url, then replace the label
- if (style->isLink() && style->getLinkHREF() == url)
+ if (style->getLinkHREF() == url)
{
S32 start = seg->getStart();
S32 end = seg->getEnd();
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 3a3a5d0e20..ddf604c195 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -315,6 +315,7 @@ protected:
void updateRects();
void needsScroll() { mScrollNeeded = TRUE; }
+ struct URLLabelCallback;
// Replace a URL with a new icon and label, for example, when
// avatar names are looked up.
void replaceUrl(const std::string &url, const std::string &label, const std::string& icon);
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 866c228a12..472c15a240 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -160,8 +160,9 @@ void LLUrlEntryBase::callObservers(const std::string &id,
const std::string &icon)
{
// notify all callbacks waiting on the given uuid
- std::multimap<std::string, LLUrlEntryObserver>::iterator it;
- for (it = mObservers.find(id); it != mObservers.end();)
+ typedef std::multimap<std::string, LLUrlEntryObserver>::iterator observer_it;
+ std::pair<observer_it, observer_it> matching_range = mObservers.equal_range(id);
+ for (observer_it it = matching_range.first; it != matching_range.second;)
{
// call the callback - give it the new label
LLUrlEntryObserver &observer = it->second;
@@ -342,8 +343,9 @@ void LLUrlEntryAgent::callObservers(const std::string &id,
const std::string &icon)
{
// notify all callbacks waiting on the given uuid
- std::multimap<std::string, LLUrlEntryObserver>::iterator it;
- for (it = mObservers.find(id); it != mObservers.end();)
+ typedef std::multimap<std::string, LLUrlEntryObserver>::iterator observer_it;
+ std::pair<observer_it, observer_it> matching_range = mObservers.equal_range(id);
+ for (observer_it it = matching_range.first; it != matching_range.second;)
{
// call the callback - give it the new label
LLUrlEntryObserver &observer = it->second;
@@ -492,26 +494,7 @@ std::string LLUrlEntryAgent::getIcon(const std::string &url)
// x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username)
//
LLUrlEntryAgentName::LLUrlEntryAgentName()
-{
-}
-
-// virtual
-void LLUrlEntryAgentName::callObservers(const std::string &id,
- const std::string &label,
- const std::string &icon)
-{
- // notify all callbacks waiting on the given uuid
- std::multimap<std::string, LLUrlEntryObserver>::iterator it;
- for (it = mObservers.find(id); it != mObservers.end();)
- {
- // call the callback - give it the new label
- LLUrlEntryObserver &observer = it->second;
- (*observer.signal)(observer.url, label, icon);
- // then remove the signal - we only need to call it once
- delete observer.signal;
- mObservers.erase(it++);
- }
-}
+{}
void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id,
const LLAvatarName& av_name)
@@ -557,14 +540,10 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab
}
}
-std::string LLUrlEntryAgentName::getUrl(const std::string &url) const
-{
- return LLStringUtil::null;
-}
-
LLStyle::Params LLUrlEntryAgentName::getStyle() const
{
- return LLStyle::Params();
+ // don't override default colors
+ return LLStyle::Params().is_link(false);
}
//
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index cd93d1ac41..5be3c6a45b 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -186,10 +186,8 @@ class LLUrlEntryAgentName : public LLUrlEntryBase
public:
LLUrlEntryAgentName();
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
- /*virtual*/ std::string getUrl(const std::string &string) const;
/*virtual*/ LLStyle::Params getStyle() const;
protected:
- /*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon);
// override this to pull out relevant name fields
virtual std::string getName(const LLAvatarName& avatar_name) = 0;
private:
diff --git a/indra/llui/llurlmatch.h b/indra/llui/llurlmatch.h
index 43bd9da14a..3b15a156a8 100644
--- a/indra/llui/llurlmatch.h
+++ b/indra/llui/llurlmatch.h
@@ -34,7 +34,7 @@
#ifndef LL_LLURLMATCH_H
#define LL_LLURLMATCH_H
-#include "linden_common.h"
+//#include "linden_common.h"
#include <string>
#include <vector>
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index c091686ffb..bd56da9121 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1319,8 +1319,6 @@ void LLView::drawChildren()
if (viewp->getVisible() && viewp->getRect().isValid())
{
- // check for bad data
- llassert_always(viewp->getVisible() == TRUE);
// Only draw views that are within the root view
localRectToScreen(viewp->getRect(),&screenRect);
if ( rootRect.overlaps(screenRect) && LLUI::sDirtyRect.overlaps(screenRect))
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 4463b6cc6f..009d82ed99 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -25,6 +25,7 @@
#include "llurlentry_stub.cpp"
#include "lltut.h"
#include "../lluicolortable.h"
+#include "../lluiimage.h"
#include <boost/regex.hpp>
@@ -35,6 +36,26 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa
LLUIColor::LLUIColor() : mColorPtr(NULL) {}
+LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image)
+{
+}
+
+LLUIImage::~LLUIImage()
+{
+}
+
+//virtual
+S32 LLUIImage::getWidth() const
+{
+ return 0;
+}
+
+//virtual
+S32 LLUIImage::getHeight() const
+{
+ return 0;
+}
+
namespace tut
{
struct LLUrlEntryData
diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp
index 85318196e0..d6ef5132c8 100644
--- a/indra/llui/tests/llurlmatch_test.cpp
+++ b/indra/llui/tests/llurlmatch_test.cpp
@@ -20,7 +20,10 @@
* $/LicenseInfo$
*/
+#include "linden_common.h"
+
#include "../llurlmatch.h"
+#include "../lluiimage.h"
#include "lltut.h"
// link seams
@@ -33,6 +36,26 @@ LLStyle::Params::Params()
{
}
+LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image)
+{
+}
+
+LLUIImage::~LLUIImage()
+{
+}
+
+//virtual
+S32 LLUIImage::getWidth() const
+{
+ return 0;
+}
+
+//virtual
+S32 LLUIImage::getHeight() const
+{
+ return 0;
+}
+
namespace LLInitParam
{
BaseBlock::BaseBlock() {}
@@ -105,7 +128,6 @@ namespace LLInitParam
void TypedParam<LLUIImage*>::setBlockFromValue()
{}
-
bool ParamCompare<LLUIImage*, false>::equals(
LLUIImage* const &a,