From aeac322191ce47f38c45db86e34469fb6fe7bb76 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Fri, 20 Aug 2010 10:03:57 -0400 Subject: order text selection by line centers The older logic assumed that lines don't overlap, but in the case of Google news, the lines do overlap. The new logic uses the line centers for ordering. Change-Id: I56074d289f76ed5027e3a498753caf50644b97f0 http://b/262451 --- WebKit/android/nav/SelectText.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'WebKit') diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp index 9792cd3..3716b03 100644 --- a/WebKit/android/nav/SelectText.cpp +++ b/WebKit/android/nav/SelectText.cpp @@ -1542,9 +1542,9 @@ bool SelectText::wordSelection(const SkPicture* picture) void SelectText::swapAsNeeded() { - if (m_selStart.fTop >= m_selEnd.fBottom - || (m_selStart.fBottom > m_selEnd.fTop - && m_selStart.fRight > m_selEnd.fLeft)) + if (m_selStart.fTop >= (m_selEnd.fTop + m_selEnd.fBottom) >> 1 + || (m_selEnd.fTop < (m_selStart.fTop + m_selStart.fBottom) >> 1 + && m_selStart.fRight > m_selEnd.fLeft)) { SkTSwap(m_startBase, m_endBase); SkTSwap(m_selStart, m_selEnd); -- cgit v1.1