Fix for issue N_SE-41786
authorKunal Sinha <kunal.sinha@samsung.com>
Sat, 22 Jun 2013 09:50:24 +0000 (15:20 +0530)
committerSudha <sudha.reddy@samsung.com>
Mon, 24 Jun 2013 09:35:23 +0000 (15:05 +0530)
Change-Id: Icec0b26f026481eaf3afa23056b714e6b225029c
Signed-off-by: Kunal Sinha <kunal.sinha@samsung.com>
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/inc/FUiCtrl_EditPresenter.h

index bef4b44..544ff9c 100755 (executable)
@@ -236,6 +236,7 @@ _EditPresenter::_EditPresenter(void)
        , __columnCursorIndex(-1)
        , __isPasswordVisible(false)
        , __needToCreateCopyPastePopup(false)
+       , __calculatedCursorBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
 {
 }
 
@@ -2760,7 +2761,14 @@ _EditPresenter::CalculateCursorBounds(const FloatRectangle& textBounds, FloatRec
                (cursorBounds.y < textBounds.y + textBounds.height))
        {
                float cursorHeightDiff = cursorBounds.y + cursorBounds.height - textBounds.y - textBounds.height - 1.0f;
-               cursorBounds.height -= cursorHeightDiff;
+               if (cursorHeightDiff > 0.0f)
+               {
+                       cursorBounds.height -= cursorHeightDiff;
+               }
+               else
+               {
+                       cursorBounds.height += cursorHeightDiff;
+               }
        }
 
        if (__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
@@ -2815,7 +2823,7 @@ _EditPresenter::CalculateCursorBounds(const FloatRectangle& textBounds, FloatRec
                        }
                }
        }
-
+       __calculatedCursorBounds = cursorBounds;
        return E_SUCCESS;
 }
 
@@ -2869,7 +2877,14 @@ _EditPresenter::CalculateCursorBounds(const FloatRectangle& textBounds, FloatRec
                (cursorBounds.y < textBounds.y + textBounds.height))
        {
                float cursorHeightDiff = cursorBounds.y + cursorBounds.height - textBounds.y - textBounds.height - 1.0f;
-               cursorBounds.height -= cursorHeightDiff;
+               if (cursorHeightDiff > 0.0f)
+               {
+                       cursorBounds.height -= cursorHeightDiff;
+               }
+               else
+               {
+                       cursorBounds.height += cursorHeightDiff;
+               }
        }
 
        if (__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
@@ -2924,7 +2939,7 @@ _EditPresenter::CalculateCursorBounds(const FloatRectangle& textBounds, FloatRec
                        }
                }
        }
-
+       __calculatedCursorBounds = cursorBounds;
        return E_SUCCESS;
 }
 
@@ -6456,7 +6471,14 @@ _EditPresenter::CalculateAbsoluteCursorBounds(int index, FloatRectangle& absCurs
 
        if (cursorHeight > 0.0f)
        {
-               absCursorBounds.height = cursorHeight;
+               if (cursorHeight <= __calculatedCursorBounds.height)
+               {
+                       absCursorBounds.height = cursorHeight;
+               }
+               else
+               {
+                       absCursorBounds.height = __calculatedCursorBounds.height;
+               }
        }
        else
        {
@@ -6502,7 +6524,14 @@ _EditPresenter::CalculateAbsoluteCursorBounds(int rowIndex, int columnIndex, Flo
 
        if (cursorHeight > 0.0f)
        {
-               absCursorBounds.height = cursorHeight;
+               if (cursorHeight <= __calculatedCursorBounds.height)
+               {
+                       absCursorBounds.height = cursorHeight;
+               }
+               else
+               {
+                       absCursorBounds.height = __calculatedCursorBounds.height;
+               }
        }
        else
        {
index 9b03627..6504935 100755 (executable)
@@ -582,6 +582,8 @@ private:
        int __columnCursorIndex;
        bool __isPasswordVisible;
        bool __needToCreateCopyPastePopup;
+       FloatRectangle __calculatedCursorBounds;
+
 }; // _EditPresenter
 
 }}} // Tizen::Ui::Controls