Skip to content

Commit

Permalink
Revert of Content in disabled input field should not be selectable. (…
Browse files Browse the repository at this point in the history
…patchset #4 id:80001 of https://codereview.chromium.org/2145323002/ )

Reason for revert:
It caused regression:
https://bugs.chromium.org/p/chromium/issues/detail?id=656736

Original issue's description:
> Content in disabled input field should not be selectable.
>
> Spec: https://html.spec.whatwg.org/multipage/forms.html#the-readonly-attribute:attr-input-readonly
>
> BUG=626581
>
> Committed: https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c
> Cr-Commit-Position: refs/heads/master@{#405717}

TBR=tkent@chromium.org,ramya.v@samsung.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=626581

Review-Url: https://codereview.chromium.org/2455853002
Cr-Commit-Position: refs/heads/master@{#428261}
  • Loading branch information
yoichio authored and Commit bot committed Oct 28, 2016
1 parent 253a151 commit e16d4aa
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ PASS successfullyParsed is true
TEST COMPLETE
PASS window.getSelection().toString() is "NormalInput"
PASS window.getSelection().toString() is "ReadonlyInput"
PASS window.getSelection().toString() is ""
PASS window.getSelection().toString() is ""
PASS window.getSelection().toString() is "DisabledInput"
PASS window.getSelection().toString() is "ReadonlyDisabledInput"
PASS window.getSelection().toString() is "NormalTextarea"
PASS window.getSelection().toString() is "ReadonlyTextarea"
PASS window.getSelection().toString() is ""
PASS window.getSelection().toString() is ""
PASS window.getSelection().toString() is "DisabledTextarea"
PASS window.getSelection().toString() is "ReadonlyDisabledTextarea"

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
if (!window.eventSender || !window.eventSender.gestureLongPress) {
debug("gestureLongPress not implemented by this platform.");
debug("Manullay long press on every element in the page and check whether Text selection is happening or not");
debug("If Text selection is not happening for readonly input/textarea, then it's a failure.");
debug("If Text selection is not happening for readonly or disabled input/textarea, then it's a failure.");
return;
}

Expand Down Expand Up @@ -37,10 +37,10 @@
</script>
<input id="normalText" type="text" value="NormalInput">
<input id="readOnlyText" type="text" value="ReadonlyInput" readonly>
<input id="disabledText" type="text" value="" disabled>
<input id="readOnlyDisabledText" size="20" type="text" value=""readonly disabled>
<input id="disabledText" type="text" value="DisabledInput" disabled>
<input id="readOnlyDisabledText" size="20" type="text" value="ReadonlyDisabledInput"readonly disabled>
<textarea id="normalTextArea" cols="31">NormalTextarea</textarea>
<textarea id="readOnlyTextArea" cols="31" readonly>ReadonlyTextarea</textarea>
<textarea id="disabledTextArea" cols="31" disabled></textarea>
<textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled></textarea>
<textarea id="disabledTextArea" cols="31" disabled>DisabledTextarea</textarea>
<textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>ReadonlyDisabledTextarea</textarea>

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ double clicking on readonly input
PASS selectEventFiredOnReadonlyInput is true

double clicking on disabled input
PASS selectEventFiredOnDisabledInput is false
PASS selectEventFiredOnDisabledInput is true

double clicking on normal textarea
PASS selectEventFiredOnTextarea is true
Expand All @@ -14,7 +14,7 @@ double clicking on readonly textarea
PASS selectEventFiredOnReadonlyTextarea is true

double clicking on disabled textarea
PASS selectEventFiredOnDisabledTextarea is false
PASS selectEventFiredOnDisabledTextarea is true

PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

debug('double clicking on disabled input');
doubleClickOn(disabledInput);
shouldBeFalse('selectEventFiredOnDisabledInput');
shouldBeTrue('selectEventFiredOnDisabledInput');
debug('');

debug('double clicking on normal textarea');
Expand All @@ -80,7 +80,7 @@

debug('double clicking on disabled textarea');
doubleClickOn(disabledTextarea);
shouldBeFalse('selectEventFiredOnDisabledTextarea');
shouldBeTrue('selectEventFiredOnDisabledTextarea');
debug('');

container.innerHTML = "";
Expand Down
3 changes: 0 additions & 3 deletions third_party/WebKit/Source/core/dom/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,6 @@ int Node::maxCharacterOffset() const {
// FIXME: Shouldn't these functions be in the editing code? Code that asks
// questions about HTML in the core DOM class is obviously misplaced.
bool Node::canStartSelection() const {
if (isDisabledFormControl(this))
return false;

if (hasEditableStyle(*this))
return true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,9 @@ bool SelectionController::handleGestureLongPress(
if (!innerNode)
return false;
innerNode->document().updateStyleAndLayoutTree();
bool innerNodeIsSelectable =
hasEditableStyle(*innerNode) || innerNode->canStartSelection();
bool innerNodeIsSelectable = hasEditableStyle(*innerNode) ||
innerNode->isTextNode() ||
innerNode->canStartSelection();
if (!innerNodeIsSelectable)
return false;

Expand Down

0 comments on commit e16d4aa

Please sign in to comment.