Don't look for clicking urls during draw, do that later upon click

This commit is contained in:
Lirusaito
2019-01-20 04:35:21 -05:00
parent 4f32024d3b
commit f6beee3693
2 changed files with 9 additions and 12 deletions

View File

@@ -345,7 +345,6 @@ LLTextEditor::LLTextEditor(
resetDirty(); // Update saved text state resetDirty(); // Update saved text state
mHTML.clear();
// make the popup menu available // make the popup menu available
//LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view);
LLMenuGL* menu = new LLMenuGL("rclickmenu"); LLMenuGL* menu = new LLMenuGL("rclickmenu");
@@ -3599,13 +3598,6 @@ void LLTextEditor::drawText()
style->mUnderline = TRUE; style->mUnderline = TRUE;
} }
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
if ( (mParseHTML) && (left_pos > seg_start) && (left_pos < clipped_end) && mIsSelecting && (mSelectionStart == mSelectionEnd) )
{
mHTML = style->getLinkHREF();
}
drawClippedSegment( text, seg_start, clipped_end, text_x, text_y, selection_left, selection_right, style, &text_x ); drawClippedSegment( text, seg_start, clipped_end, text_x, text_y, selection_left, selection_right, style, &text_x );
if( text_x == text_start && mShowLineNumbers ) if( text_x == text_start && mShowLineNumbers )
@@ -4805,10 +4797,16 @@ BOOL LLTextEditor::handleMouseUpOverSegment(S32 x, S32 y, MASK mask)
// This mouse up was part of a click. // This mouse up was part of a click.
// Regardless of where the cursor is, see if we recently touched a link // Regardless of where the cursor is, see if we recently touched a link
// and launch it if we did. // and launch it if we did.
if (mParseHTML && mHTML.length() > 0) if (mParseHTML)
{ {
LLUrlAction::clickAction(mHTML); if (auto segment = getSegmentAtLocalPos(x, y))
mHTML.clear(); {
if (auto style = segment->getStyle())
{
if (style->isLink())
LLUrlAction::clickAction(style->getLinkHREF());
}
}
} }
} }

View File

@@ -456,7 +456,6 @@ protected:
BOOL mParseHTML; BOOL mParseHTML;
BOOL mParseHighlights; BOOL mParseHighlights;
std::string mHTML;
typedef std::vector<LLTextSegmentPtr> segment_list_t; typedef std::vector<LLTextSegmentPtr> segment_list_t;
segment_list_t mSegments; segment_list_t mSegments;