Commit 7547d0ee authored by ajith.v@samsung.com's avatar ajith.v@samsung.com

Paste Popup showing is blocked for ReadOnly/Disabled input and textarea elements.

Editable element check is not taken care of disabled and readonly elements
after getting the hittest result. Hence causing this issue. In this patch we
are checking whether the element is readonly or disabled and not allowing
paste popup to show.

BUG=

Review URL: https://codereview.chromium.org/246203004

git-svn-id: svn://svn.chromium.org/blink/trunk@183874 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a696c444
PASS successfullyParsed is true
TEST COMPLETE
PASS normalText is normalText
PASS readOnlyText is readOnlyText
PASS disabledText is disabledText
PASS readOnlyDisabledText is readOnlyDisabledText
PASS normalTextArea is normalTextArea
PASS readOnlyTextArea is readOnlyTextArea
PASS disabledTextArea is disabledTextArea
PASS readOnlyDisabledTextArea is readOnlyDisabledTextArea
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
function test() {
jsTestAsync = true;
if (window.testRunner)
testRunner.dumpAsText();
if (!window.eventSender)
return;
if (!window.eventSender.gestureLongPress) {
debug("gestureLongPress not implemented by this platform.");
debug("Manullay long press on every element in the page and check whether Paste Popup is appearing or not");
debug("If Paste popup is appearing for readonly or disabled input/textarea, then it's a failure.");
return;
}
// Normal Text
doLongPressOnElement("normalText");
// ReadOnly Text
doLongPressOnElement("readOnlyText");
// Disabled Text
doLongPressOnElement("disabledText");
// ReadOnly and Disabled Text
doLongPressOnElement("readOnlyDisabledText");
// Normal TextArea
doLongPressOnElement("normalTextArea");
// ReadOnly TextArea
doLongPressOnElement("readOnlyTextArea");
// Disabled TextArea
doLongPressOnElement("disabledTextArea");
// ReadOnly and Disabled TextArea
doLongPressOnElement("readOnlyDisabledTextArea");
finishJSTest();
}
function doLongPressOnElement(elementId) {
var element = document.getElementById(elementId);
var bounds = element.getBoundingClientRect();
var middleX = (bounds.left + bounds.right) / 2;
var middleY = (bounds.top + bounds.bottom) / 2;
// Touch directly in the center of the element.
window.eventSender.gestureLongPress(middleX, middleY);
var touchNode = document.elementFromPoint(middleX, middleY);
shouldBe(touchNode.id, elementId);
}
</script>
</head>
<body onload="test();">
<input id="normalText" type="text" value="Normal input">
<input id="readOnlyText" type="text" value="Readonly input" readonly>
<input id="disabledText" type="text" value="Disabled input" disabled>
<input id="readOnlyDisabledText" size="20" type="text" value="Readonly Disabled input"readonly disabled>
<textarea id="normalTextArea" cols="31">Normal textarea</textarea>
<textarea id="readOnlyTextArea" cols="31" readonly>Readonly textarea</textarea>
<textarea id="disabledTextArea" cols="31" disabled>Disabled textarea</textarea>
<textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>Readonly Disabled textarea</textarea>
</body>
</html>
......@@ -33,6 +33,7 @@
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/HTMLTextAreaElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/page/FrameTree.h"
#include "core/rendering/RenderImage.h"
......@@ -371,10 +372,12 @@ bool HitTestResult::isContentEditable() const
return false;
if (isHTMLTextAreaElement(*m_innerNonSharedNode))
return true;
return !toHTMLTextAreaElement(*m_innerNonSharedNode).isDisabledOrReadOnly();
if (isHTMLInputElement(*m_innerNonSharedNode))
return toHTMLInputElement(*m_innerNonSharedNode).isTextField();
if (isHTMLInputElement(*m_innerNonSharedNode)) {
HTMLInputElement& inputElement = toHTMLInputElement(*m_innerNonSharedNode);
return !inputElement.isDisabledOrReadOnly() && inputElement.isTextField();
}
return m_innerNonSharedNode->hasEditableStyle();
}
......
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