summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorDessie Linden <dessie@lindenlab.com>2010-06-07 11:27:42 -0700
committerDessie Linden <dessie@lindenlab.com>2010-06-07 11:27:42 -0700
commit085b2c24f9ded3d0e9a33500a287aaa53e8b7fba (patch)
tree0f2ad3881231003f14c3bd9a96d2f284114facbd /indra/llui
parent4db92e5155f604492cbc8f5053bcd24237e3c3b6 (diff)
parentea5d8a1634a0457e57251b7a7ce76631cfd3f745 (diff)
Merge from viewer-public
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltextbase.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 55dbf50fd7..d86709c448 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1101,7 +1101,7 @@ S32 LLTextBase::getLeftOffset(S32 width)
case LLFontGL::LEFT:
return mHPad;
case LLFontGL::HCENTER:
- return mHPad + (mVisibleTextRect.getWidth() - width - mHPad) / 2;
+ return mHPad + llmax(0, (mVisibleTextRect.getWidth() - width - mHPad) / 2);
case LLFontGL::RIGHT:
return mVisibleTextRect.getWidth() - width;
default:
@@ -1207,11 +1207,6 @@ void LLTextBase::reflow()
// grow line height as necessary based on reported height of this segment
line_height = llmax(line_height, segment_height);
remaining_pixels -= segment_width;
- if (remaining_pixels < 0)
- {
- // getNumChars() and getDimensions() should return consistent results
- remaining_pixels = 0;
- }
seg_offset += character_count;
@@ -1893,7 +1888,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
{
// Figure out which line we're nearest to.
LLRect visible_region = getVisibleDocumentRect();
-
+
// binary search for line that starts before local_y
line_list_t::const_iterator line_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), local_y - mVisibleTextRect.mBottom + visible_region.mBottom, compare_bottom());
@@ -1903,7 +1898,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
}
S32 pos = getLength();
- S32 start_x = mVisibleTextRect.mLeft + line_iter->mRect.mLeft;
+ S32 start_x = mVisibleTextRect.mLeft + line_iter->mRect.mLeft - visible_region.mLeft;
segment_set_t::iterator line_seg_iter;
S32 line_seg_offset;