Bug 462758 - elements with contenteditable=true and position:absolute can be moved around the page; r=ehsan

This commit is contained in:
Fabien Cazenave 2011-09-07 13:34:58 -04:00
parent 3c08d8f362
commit 1867ac8ecd
5 changed files with 75 additions and 7 deletions

View File

@ -368,9 +368,11 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
}
// now, let's display all contextual UI for good
nsIContent* hostContent = GetActiveEditingHost();
nsCOMPtr<nsIDOMNode> hostNode = do_QueryInterface(hostContent);
if (mIsObjectResizingEnabled && focusElement &&
IsModifiableNode(focusElement)) {
IsModifiableNode(focusElement) && focusElement != hostNode) {
if (nsEditProperty::img == focusTagAtom)
mResizedObjectIsAnImage = PR_TRUE;
if (mResizedObject)
@ -381,7 +383,7 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
}
if (mIsAbsolutelyPositioningEnabled && absPosElement &&
IsModifiableNode(absPosElement)) {
IsModifiableNode(absPosElement) && absPosElement != hostNode) {
if (mAbsolutelyPositionedObject)
res = RefreshGrabber();
else
@ -390,7 +392,7 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
}
if (mIsInlineTableEditingEnabled && cellElement &&
IsModifiableNode(cellElement)) {
IsModifiableNode(cellElement) && cellElement != hostNode) {
if (mInlineEditedCell)
res = RefreshInlineTableEditingUI();
else

View File

@ -258,11 +258,9 @@ load 471594-1.xhtml
load 479114-1.html
load 477333-1.xhtml
asserts-if(Android,6) load 477731-1.html
# 479360-1.xhtml will assert 6 times due to bug 439258 and then make the test
# after the test after it also assert 6 times.
asserts-if(!Android,6) load 479360-1.xhtml # Bug 439258
load 479360-1.xhtml
asserts-if(Android,6) load 480686-1.html
asserts-if(!Android,6) load 481806-1.html # Bug 439258
load 481806-1.html
load 483604-1.xhtml
load 485501-1.html
load 487544-1.html

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script type="text/javascript">
function init() {
var editor = document.querySelector("div[contenteditable]");
editor.addEventListener("focus", function() {
setTimeout(function() {
document.documentElement.className = "";
}, 0);
}, false);
editor.focus();
}
</script>
<style type="text/css">
html, body, div {
margin: 0;
padding: 0;
}
div {
border: 1px solid black;
margin: 50px;
height: 200px;
width: 200px;
}
</style>
</head>
<body onload="init()">
<div contenteditable>
this editable container should be neither draggable nor resizable.
</div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script type="text/javascript">
function init() {
var editor = document.querySelector("div[contenteditable]");
editor.addEventListener("focus", function() {
setTimeout(function() {
document.documentElement.className = "";
}, 0);
}, false);
editor.focus();
}
</script>
<style type="text/css">
html, body, div {
margin: 0;
padding: 0;
}
div {
border: 1px solid black;
margin: 50px;
height: 200px;
width: 200px;
}
</style>
</head>
<body onload="init()">
<div contenteditable style="position: absolute">
this editable container should be neither draggable nor resizable.
</div>
</body>
</html>

View File

@ -68,3 +68,4 @@ fails-if(Android) != spellcheck-hyphen-multiple-invalid.html spellcheck-hyphen-m
skip-if(Android) == 674212-spellcheck.html 674212-spellcheck-ref.html
skip-if(Android) == 338427-2.html 338427-2-ref.html
skip-if(Android) == 338427-3.html 338427-3-ref.html
== 462758-grabbers-resizers.html 462758-grabbers-resizers-ref.html