Commit 1b3aa5da authored by tkent's avatar tkent Committed by Commit bot

Fix selectionDirection attribute value of INPUT/TEXTAREA just after creation.

selectionDirection incorrectly returned "none" in such case even on non-Mac
platforms.

BUG=640861

Review-Url: https://codereview.chromium.org/2285613002
Cr-Commit-Position: refs/heads/master@{#414678}
parent e70ca0a2
......@@ -4,6 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
input on Mac
PASS selectionDirection was "none" after just creating
PASS selectionDirection was "none" after focusing and setting selection by setSelectionRange(1, 2)
PASS selectionDirection was "none" after focusing on another element
PASS selectionDirection was "none" after hiding the element
......@@ -31,6 +32,7 @@ PASS selectionDirection was "backward" after hiding the element
PASS selectionDirection was "none" after updating value
textarea on Mac
PASS selectionDirection was "none" after just creating
PASS selectionDirection was "none" after focusing and setting selection by setSelectionRange(1, 2)
PASS selectionDirection was "none" after focusing on another element
PASS selectionDirection was "none" after hiding the element
......@@ -58,6 +60,7 @@ PASS selectionDirection was "backward" after hiding the element
PASS selectionDirection was "none" after updating value
input on Win
PASS selectionDirection was "forward" after just creating
PASS selectionDirection was "forward" after focusing and setting selection by setSelectionRange(1, 2)
PASS selectionDirection was "forward" after focusing on another element
PASS selectionDirection was "forward" after hiding the element
......@@ -85,6 +88,7 @@ PASS selectionDirection was "backward" after hiding the element
PASS selectionDirection was "forward" after updating value
textarea on Win
PASS selectionDirection was "forward" after just creating
PASS selectionDirection was "forward" after focusing and setting selection by setSelectionRange(1, 2)
PASS selectionDirection was "forward" after focusing on another element
PASS selectionDirection was "forward" after hiding the element
......@@ -112,6 +116,7 @@ PASS selectionDirection was "backward" after hiding the element
PASS selectionDirection was "forward" after updating value
input on Unix
PASS selectionDirection was "forward" after just creating
PASS selectionDirection was "forward" after focusing and setting selection by setSelectionRange(1, 2)
PASS selectionDirection was "forward" after focusing on another element
PASS selectionDirection was "forward" after hiding the element
......@@ -139,6 +144,7 @@ PASS selectionDirection was "backward" after hiding the element
PASS selectionDirection was "forward" after updating value
textarea on Unix
PASS selectionDirection was "forward" after just creating
PASS selectionDirection was "forward" after focusing and setting selection by setSelectionRange(1, 2)
PASS selectionDirection was "forward" after focusing on another element
PASS selectionDirection was "forward" after hiding the element
......
......@@ -39,6 +39,9 @@ function runTest(element, platform) {
var noneOnMacAndForwardOnOthers = (platform == 'Mac') ? 'none' : 'forward';
var newElement = document.createElement(element.tagName);
assertDirection(noneOnMacAndForwardOnOthers, newElement, 'just creating');
element.setSelectionRange(1, 2);
assertDirection(noneOnMacAndForwardOnOthers, element, 'focusing and setting selection by setSelectionRange(1, 2)');
testCache(noneOnMacAndForwardOnOthers, element);
......
......@@ -62,8 +62,8 @@ HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagN
, m_lastChangeWasUserEdit(false)
, m_cachedSelectionStart(0)
, m_cachedSelectionEnd(0)
, m_cachedSelectionDirection(SelectionHasNoDirection)
{
m_cachedSelectionDirection = doc.frame() && doc.frame()->editor().behavior().shouldConsiderSelectionAsDirectional() ? SelectionHasForwardDirection : SelectionHasNoDirection;
}
HTMLTextFormControlElement::~HTMLTextFormControlElement()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment