--- old/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp 2016-02-11 12:21:59.612086715 +0530 +++ new/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp 2016-02-11 12:21:59.388086715 +0530 @@ -157,27 +157,12 @@ /* * We consume WM_MOUSEMOVE while the left mouse button is pressed, - * so we have to simulate autoscrolling when mouse is moved outside + * so we have to simulate selection autoscrolling when mouse is moved outside * of the client area. */ POINT p; - RECT r; - BOOL bScrollLeft = FALSE; - BOOL bScrollRight = FALSE; - BOOL bScrollUp = FALSE; - BOOL bScrollDown = FALSE; - p.x = msg->pt.x; p.y = msg->pt.y; - VERIFY(::GetClientRect(GetHWnd(), &r)); - - if (p.x < 0) { - bScrollLeft = TRUE; - p.x = 0; - } else if (p.x > r.right) { - bScrollRight = TRUE; - p.x = r.right - 1; - } LONG lCurPos = EditGetCharFromPos(p); if (GetStartSelectionPos() != -1 && @@ -193,32 +178,6 @@ EditSetSel(cr); } - - if (bScrollLeft == TRUE || bScrollRight == TRUE) { - SCROLLINFO si; - memset(&si, 0, sizeof(si)); - si.cbSize = sizeof(si); - si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; - - SendMessage(EM_SHOWSCROLLBAR, SB_HORZ, TRUE); - VERIFY(::GetScrollInfo(GetHWnd(), SB_HORZ, &si)); - SendMessage(EM_SHOWSCROLLBAR, SB_HORZ, FALSE); - - if (bScrollLeft == TRUE) { - si.nPos = si.nPos - si.nPage / 2; - si.nPos = max(si.nMin, si.nPos); - } else if (bScrollRight == TRUE) { - si.nPos = si.nPos + si.nPage / 2; - si.nPos = min(si.nPos, si.nMax); - } - /* - * Okay to use 16-bit position since RichEdit control adjusts - * its scrollbars so that their range is always 16-bit. - */ - DASSERT(abs(si.nPos) < 0x8000); - SendMessage(WM_HSCROLL, - MAKEWPARAM(SB_THUMBPOSITION, LOWORD(si.nPos))); - } delete msg; return mrConsume; } else if (msg->message == WM_KEYDOWN) { --- old/test/java/awt/TextField/ScrollSelectionTest/ScrollSelectionTest.java 2016-02-11 12:22:00.124086715 +0530 +++ new/test/java/awt/TextField/ScrollSelectionTest/ScrollSelectionTest.java 2016-02-11 12:21:59.892086715 +0530 @@ -23,23 +23,17 @@ /* test - @bug 4118621 - @summary tests that selected text isn't scrolled when there is enough room. - @author prs: area=TextField + @bug 4118621 8149636 + @summary Test the selection scrolling in TextField. @run applet/manual=yesno ScrollSelectionTest.html */ -/** - * ScrollSelectionTest.java - * - * summary: tests that selected text isn't scrolled when there is enough room. - */ - import java.applet.Applet; import java.awt.Dialog; import java.awt.Frame; import java.awt.TextField; import java.awt.TextArea; +import java.awt.FlowLayout; public class ScrollSelectionTest extends Applet { @@ -51,15 +45,30 @@ { tf.setText("abcdefghijklmnopqrstuvwxyz"); frame.add(tf); + frame.setLayout(new FlowLayout()); tf.select(0, 20); String[] instructions = { - "INSTRUCTIONS:", + "INSTRUCTIONS: There are 3 Tests", + "Test1: Text visibility with Scroll ", "This is a test for a win32 specific problem", - "If you see all the letters from 'a' to 'z' and", + "If you see all the letters from 'a' to 'z' and", "letters from 'a' to 't' are selected then test passes.", - "You may have to activate the frame to see the selection" - + " highlighted (e.g. by clicking on frame's title)." + "You may have to activate the frame to see the selection", + "highlighted (e.g. by clicking on frame's title).", + ".", + "Test2: Flicker with selection scroll", + "Mouse press on te TextField text", + "Move mouse towards left or right with selecting text", + "Move mouse away outside the bounds of TextField", + "No flicker should be observed.", + ".", + "Test3: Over scroll on right", + "Mouse press on te TextField text", + "Move mouse towards Right", + "Move mouse away outside the bounds of TextField", + "Observe TextField text does not get scrolled towards left", + "as there is no need to scroll", }; Sysout.createDialogWithInstructions( instructions ); @@ -67,11 +76,11 @@ public void start () { - setSize (300,300); + setSize (300, 500); setVisible(true); frame.setVisible(true); - frame.setBounds (400, 0, 300, 300); + frame.setBounds (400, 0, 400, 300); }// start()