Bug 1097242 - Make sure contenteditable -moz-user-select styles can be overridden by web pages; r=dbaron

This commit is contained in:
Ehsan Akhgari 2015-03-04 13:00:47 -05:00
parent 219657b6df
commit 9a96471db6
5 changed files with 48 additions and 13 deletions

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<script>
function test() {
focus();
var div = document.querySelector("div");
div.focus();
getSelection().collapse(div.firstChild, 0);
}
</script>
<body onload="test()">
<div contenteditable spellcheck="false" style="outline: none">foo<span>bar</span>baz</div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
function test() {
focus();
synthesizeMouseAtCenter(document.querySelector("span"), {});
}
function focused() {
document.documentElement.removeAttribute("class");
}
</script>
<body onload="setTimeout(test, 0)">
<div contenteditable spellcheck="false" onfocus="focused()"
style="outline: none">foo<span contenteditable=false
style="-moz-user-select: none">bar</span>baz</div>
</body>
</html>

View File

@ -62,6 +62,8 @@ support-files =
bug989012-3-ref.html
bug1061468.html
bug1061468-ref.html
bug1097242-1.html
bug1097242-1-ref.html
bug1109968-1-ref.html
bug1109968-1.html
bug1109968-2-ref.html

View File

@ -148,6 +148,7 @@ var tests = [
[ 'bug1007065-1.html' , 'bug1007065-1-ref.html' ] ,
[ 'bug1007067-1.html' , 'bug1007067-1-ref.html' ] ,
[ 'bug1061468.html' , 'bug1061468-ref.html' ] ,
[ 'bug1097242-1.html', 'bug1097242-1-ref.html'] ,
[ 'bug1109968-1.html', 'bug1109968-1-ref.html'] ,
[ 'bug1109968-2.html', 'bug1109968-2-ref.html'] ,
// [ 'bug1123067-1.html' , 'bug1123067-ref.html' ] , TODO: bug 1129205

View File

@ -10,12 +10,12 @@
}
*|*:-moz-read-write :-moz-read-only {
-moz-user-select: all !important;
-moz-user-select: all;
}
input:-moz-read-write > .anonymous-div:-moz-read-only,
textarea:-moz-read-write > .anonymous-div:-moz-read-only {
-moz-user-select: text !important;
-moz-user-select: text;
}
/* Use default arrow over objects with size that
@ -55,7 +55,7 @@ a:link:-moz-read-write {
*|*:-moz-read-write > input:-moz-read-only,
*|*:-moz-read-write > button:-moz-read-only,
*|*:-moz-read-write > textarea:-moz-read-only {
-moz-user-select: all !important;
-moz-user-select: all;
-moz-user-input: auto !important;
-moz-user-focus: none !important;
}
@ -70,7 +70,7 @@ input[contenteditable="true"]:disabled,
input[contenteditable="true"][type="checkbox"],
input[contenteditable="true"][type="radio"],
input[contenteditable="true"][type="file"] {
-moz-user-select: all !important;
-moz-user-select: all;
-moz-user-input: none !important;
-moz-user-focus: none !important;
}
@ -91,15 +91,15 @@ input[contenteditable="true"][type="hidden"] {
}
label:-moz-read-write {
-moz-user-select: all !important;
-moz-user-select: all;
}
*|*::-moz-display-comboboxcontrol-frame {
-moz-user-select: text !important;
-moz-user-select: text;
}
option:-moz-read-write {
-moz-user-select: text !important;
-moz-user-select: text;
}
/* the following rules are for Image Resizing */
@ -215,7 +215,7 @@ a[\_moz_anonclass="mozTableAddColumnBefore"] {
background-image: url("resource://gre/res/table-add-column-before.gif");
background-repeat: no-repeat;
background-position: center center;
-moz-user-select: none !important;
-moz-user-select: none;
-moz-user-focus: none !important;
}
@ -237,7 +237,7 @@ a[\_moz_anonclass="mozTableAddColumnAfter"] {
background-image: url("resource://gre/res/table-add-column-after.gif");
background-repeat: no-repeat;
background-position: center center;
-moz-user-select: none !important;
-moz-user-select: none;
-moz-user-focus: none !important;
}
@ -259,7 +259,7 @@ a[\_moz_anonclass="mozTableRemoveColumn"] {
background-image: url("resource://gre/res/table-remove-column.gif");
background-repeat: no-repeat;
background-position: center center;
-moz-user-select: none !important;
-moz-user-select: none;
-moz-user-focus: none !important;
}
@ -281,7 +281,7 @@ a[\_moz_anonclass="mozTableAddRowBefore"] {
background-image: url("resource://gre/res/table-add-row-before.gif");
background-repeat: no-repeat;
background-position: center center;
-moz-user-select: none !important;
-moz-user-select: none;
-moz-user-focus: none !important;
}
@ -303,7 +303,7 @@ a[\_moz_anonclass="mozTableAddRowAfter"] {
background-image: url("resource://gre/res/table-add-row-after.gif");
background-repeat: no-repeat;
background-position: center center;
-moz-user-select: none !important;
-moz-user-select: none;
-moz-user-focus: none !important;
}
@ -325,7 +325,7 @@ a[\_moz_anonclass="mozTableRemoveRow"] {
background-image: url("resource://gre/res/table-remove-row.gif");
background-repeat: no-repeat;
background-position: center center;
-moz-user-select: none !important;
-moz-user-select: none;
-moz-user-focus: none !important;
}