Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2025-07-04 22:28:17 +08:00
commit 9175504ffc
25 changed files with 75 additions and 75 deletions

View file

@ -75,7 +75,7 @@ HyperTextAccessible::NativeState()
{ {
uint64_t states = AccessibleWrap::NativeState(); uint64_t states = AccessibleWrap::NativeState();
if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) { if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
states |= states::EDITABLE; states |= states::EDITABLE;
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) { } else if (mContent->IsHTMLElement(nsGkAtoms::article)) {

View file

@ -118,6 +118,8 @@ const PSEUDO_SELECTORS = [
[":target", 0], [":target", 0],
[":enabled", 0], [":enabled", 0],
[":disabled", 0], [":disabled", 0],
[":read-only", 1],
[":read-write", 1],
[":checked", 1], [":checked", 1],
["::selection", 0] ["::selection", 0]
]; ];

View file

@ -201,8 +201,7 @@ Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
EventStates EventStates
Element::IntrinsicState() const Element::IntrinsicState() const
{ {
return IsEditable() ? NS_EVENT_STATE_MOZ_READWRITE : return IsEditable() ? NS_EVENT_STATE_READWRITE : NS_EVENT_STATE_READONLY;
NS_EVENT_STATE_MOZ_READONLY;
} }
void void
@ -288,11 +287,11 @@ Element::UpdateEditableState(bool aNotify)
// insertion into the document and UpdateState can be slow for // insertion into the document and UpdateState can be slow for
// some kinds of elements even when not notifying. // some kinds of elements even when not notifying.
if (IsEditable()) { if (IsEditable()) {
RemoveStatesSilently(NS_EVENT_STATE_MOZ_READONLY); RemoveStatesSilently(NS_EVENT_STATE_READONLY);
AddStatesSilently(NS_EVENT_STATE_MOZ_READWRITE); AddStatesSilently(NS_EVENT_STATE_READWRITE);
} else { } else {
RemoveStatesSilently(NS_EVENT_STATE_MOZ_READWRITE); RemoveStatesSilently(NS_EVENT_STATE_READWRITE);
AddStatesSilently(NS_EVENT_STATE_MOZ_READONLY); AddStatesSilently(NS_EVENT_STATE_READONLY);
} }
} }
} }

View file

@ -158,7 +158,7 @@ public:
#ifdef MOZILLA_INTERNAL_API #ifdef MOZILLA_INTERNAL_API
explicit Element(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : explicit Element(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) :
FragmentOrElement(aNodeInfo), FragmentOrElement(aNodeInfo),
mState(NS_EVENT_STATE_MOZ_READONLY) mState(NS_EVENT_STATE_READONLY)
{ {
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE, MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE,
"Bad NodeType in aNodeInfo"); "Bad NodeType in aNodeInfo");

View file

@ -277,7 +277,7 @@ nsIContent::GetDesiredIMEState()
// Check for the special case where we're dealing with elements which don't // Check for the special case where we're dealing with elements which don't
// have the editable flag set, but are readwrite (such as text controls). // have the editable flag set, but are readwrite (such as text controls).
if (!IsElement() || if (!IsElement() ||
!AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) { !AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
return IMEState(IMEState::DISABLED); return IMEState(IMEState::DISABLED);
} }
} }

View file

@ -205,11 +205,10 @@ private:
#define NS_EVENT_STATE_INRANGE NS_DEFINE_EVENT_STATE_MACRO(15) #define NS_EVENT_STATE_INRANGE NS_DEFINE_EVENT_STATE_MACRO(15)
// Content value is out-of-range. // Content value is out-of-range.
#define NS_EVENT_STATE_OUTOFRANGE NS_DEFINE_EVENT_STATE_MACRO(16) #define NS_EVENT_STATE_OUTOFRANGE NS_DEFINE_EVENT_STATE_MACRO(16)
// These two are temporary (see bug 302188)
// Content is read-only. // Content is read-only.
#define NS_EVENT_STATE_MOZ_READONLY NS_DEFINE_EVENT_STATE_MACRO(17) #define NS_EVENT_STATE_READONLY NS_DEFINE_EVENT_STATE_MACRO(17)
// Content is editable. // Content is editable.
#define NS_EVENT_STATE_MOZ_READWRITE NS_DEFINE_EVENT_STATE_MACRO(18) #define NS_EVENT_STATE_READWRITE NS_DEFINE_EVENT_STATE_MACRO(18)
// Content is the default one (meaning depends of the context). // Content is the default one (meaning depends of the context).
#define NS_EVENT_STATE_DEFAULT NS_DEFINE_EVENT_STATE_MACRO(19) #define NS_EVENT_STATE_DEFAULT NS_DEFINE_EVENT_STATE_MACRO(19)
// Content could not be rendered (image/object/etc). // Content could not be rendered (image/object/etc).

View file

@ -1608,7 +1608,7 @@ IMEStateManager::IsEditable(nsINode* node)
} }
// |node| might be readwrite (for example, a text control) // |node| might be readwrite (for example, a text control)
if (node->IsElement() && if (node->IsElement() &&
node->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) { node->AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
return true; return true;
} }
return false; return false;

View file

@ -2198,13 +2198,13 @@ nsGenericHTMLFormElement::IntrinsicState() const
} }
// Make the text controls read-write // Make the text controls read-write
if (!state.HasState(NS_EVENT_STATE_MOZ_READWRITE) && if (!state.HasState(NS_EVENT_STATE_READWRITE) &&
IsTextOrNumberControl(/*aExcludePassword*/ false)) { IsTextOrNumberControl(/*aExcludePassword*/ false)) {
bool roState = GetBoolAttr(nsGkAtoms::readonly); bool roState = GetBoolAttr(nsGkAtoms::readonly);
if (!roState) { if (!roState) {
state |= NS_EVENT_STATE_MOZ_READWRITE; state |= NS_EVENT_STATE_READWRITE;
state &= ~NS_EVENT_STATE_MOZ_READONLY; state &= ~NS_EVENT_STATE_READONLY;
} }
} }

View file

@ -45,9 +45,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=535043
/** Test for Bug 1264157 **/ /** Test for Bug 1264157 **/
SimpleTest.waitForFocus(function() { SimpleTest.waitForFocus(function() {
// Check the initial values. // Check the initial values.
let active = [].slice.call(document.querySelectorAll("input:not(:disabled):not(:-moz-read-only)")); let active = [].slice.call(document.querySelectorAll("input:not(:disabled):not(:read-only)"));
let disabled = [].slice.call(document.querySelectorAll("input:disabled")); let disabled = [].slice.call(document.querySelectorAll("input:disabled"));
let readonly = [].slice.call(document.querySelectorAll("input:-moz-read-only")); let readonly = [].slice.call(document.querySelectorAll("input:read-only"));
ok(active.length == 2, "Test is messed up: missing non-disabled/non-readonly inputs"); ok(active.length == 2, "Test is messed up: missing non-disabled/non-readonly inputs");
ok(disabled.length == 2, "Test is messed up: missing disabled inputs"); ok(disabled.length == 2, "Test is messed up: missing disabled inputs");
ok(readonly.length == 2, "Test is messed up: missing readonly inputs"); ok(readonly.length == 2, "Test is messed up: missing readonly inputs");

View file

@ -156,8 +156,8 @@ nsXULElement::nsXULElement(already_AddRefed<mozilla::dom::NodeInfo> aNodeInfo)
// We may be READWRITE by default; check. // We may be READWRITE by default; check.
if (IsReadWriteTextElement()) { if (IsReadWriteTextElement()) {
AddStatesSilently(NS_EVENT_STATE_MOZ_READWRITE); AddStatesSilently(NS_EVENT_STATE_READWRITE);
RemoveStatesSilently(NS_EVENT_STATE_MOZ_READONLY); RemoveStatesSilently(NS_EVENT_STATE_READONLY);
} }
} }
@ -1855,8 +1855,8 @@ nsXULElement::IntrinsicState() const
EventStates state = nsStyledElement::IntrinsicState(); EventStates state = nsStyledElement::IntrinsicState();
if (IsReadWriteTextElement()) { if (IsReadWriteTextElement()) {
state |= NS_EVENT_STATE_MOZ_READWRITE; state |= NS_EVENT_STATE_READWRITE;
state &= ~NS_EVENT_STATE_MOZ_READONLY; state &= ~NS_EVENT_STATE_READONLY;
} }
return state; return state;

View file

@ -406,7 +406,7 @@ HTMLEditor::FindSelectionRoot(nsINode* aNode)
// If the content is in read-write state but is not editable itself, // If the content is in read-write state but is not editable itself,
// return it as the selection root. // return it as the selection root.
if (content->IsElement() && if (content->IsElement() &&
content->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) { content->AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
return content.forget(); return content.forget();
} }
return nullptr; return nullptr;

View file

@ -2,8 +2,8 @@
<html class="reftest-wait"> <html class="reftest-wait">
<body> <body>
<style> <style>
:-moz-read-only { color: red; } :read-only { color: red; }
:-moz-read-write { color: green; } :read-write { color: green; }
</style> </style>
<script> <script>
onload = function() { onload = function() {

View file

@ -1,8 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<style> <style>
:-moz-read-only { color: green; } :read-only { color: green; }
:-moz-read-write { color: red; } :read-write { color: red; }
</style> </style>
<body onload="document.designMode='on';document.designMode='off'"> <body onload="document.designMode='on';document.designMode='off'">
<div>test</div> <div>test</div>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<style> <style>
:-moz-read-only { color: green; } :read-only { color: green; }
:-moz-read-write { color: red; } :read-write { color: red; }
</style> </style>
<body onload="document.designMode='on';document.designMode='off'"> <body onload="document.designMode='on';document.designMode='off'">
<div>test</div> <div>test</div>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<style> <style>
:-moz-read-only { color: red; } :read-only { color: red; }
:-moz-read-write { color: green; } :read-write { color: green; }
</style> </style>
<body onload="document.designMode='on';document.designMode='off'"> <body onload="document.designMode='on';document.designMode='off'">
<div contenteditable>test</div> <div contenteditable>test</div>

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<style> <style>
:-moz-read-write + span { :read-write + span {
display: none; display: none;
} }
span { span {

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<style> <style>
:-moz-read-only + span { :read-only + span {
display: none; display: none;
} }
span { span {

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<style> <style>
:-moz-read-write + span { :read-write + span {
display: none; display: none;
} }
span { span {

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<style> <style>
:-moz-read-write + span { :read-write + span {
display: none; display: none;
} }
span { span {

View file

@ -1,6 +1,6 @@
<html class="reftest-wait"><style> <html class="reftest-wait"><style>
.c12:-moz-read-write, *|* { vertical-align: -moz-calc(30060px 36%); display: inline; -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight; border-collapse: collapse; speak: normal; width: 2.88999223464x+18mozmm; -moz-outline-radius: -219px/6827px; } .c12:read-write, *|* { vertical-align: -moz-calc(30060px 36%); display: inline; -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight; border-collapse: collapse; speak: normal; width: 2.88999223464x+18mozmm; -moz-outline-radius: -219px/6827px; }
.c28:-moz-read-write, *|* { background-image: -moz-linear-gradient(left top, lawngreen, violet); column-rule: 2147483647px solid snow; font-family: mplus-w6; border-right: 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999px solid hsla(56224, 127%, 11074%, 3.1529590536x+18); font: Arial, sans-serif; -moz-transform: matrix(9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 54, 70.084369622, 2600244143.97, 225, 200); animation: step-right 7.82973832672x+18s forwards;.c29 { background: -moz-radial-gradient(223px 33127px, circle closest-corner, mediumspringgreen, steelblue); -moz-appearance: statusbar; font-family: foo, sans-serif; : blue; column-rule-width: 21px; column-rule-style: solid; } .c28:read-write, *|* { background-image: -moz-linear-gradient(left top, lawngreen, violet); column-rule: 2147483647px solid snow; font-family: mplus-w6; border-right: 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999px solid hsla(56224, 127%, 11074%, 3.1529590536x+18); font: Arial, sans-serif; -moz-transform: matrix(9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 54, 70.084369622, 2600244143.97, 225, 200); animation: step-right 7.82973832672x+18s forwards;.c29 { background: -moz-radial-gradient(223px 33127px, circle closest-corner, mediumspringgreen, steelblue); -moz-appearance: statusbar; font-family: foo, sans-serif; : blue; column-rule-width: 21px; column-rule-style: solid; }
</style><script> </style><script>
docElement = document.documentElement; docElement = document.documentElement;
docElement.contentEditable = "true"; docElement.contentEditable = "true";

View file

@ -992,7 +992,7 @@ nsFrameSelection::MoveCaret(nsDirection aDirection,
(focusNode->IsEditable() || (focusNode->IsEditable() ||
(focusNode->IsElement() && (focusNode->IsElement() &&
focusNode->AsElement()->State(). focusNode->AsElement()->State().
HasState(NS_EVENT_STATE_MOZ_READWRITE)))) { HasState(NS_EVENT_STATE_READWRITE)))) {
// If caret moves in editor, it should cause scrolling even if it's in // If caret moves in editor, it should cause scrolling even if it's in
// overflow: hidden;. // overflow: hidden;.
scrollFlags |= Selection::SCROLL_OVERFLOW_HIDDEN; scrollFlags |= Selection::SCROLL_OVERFLOW_HIDDEN;

View file

@ -12,11 +12,11 @@
<style type="text/css"> <style type="text/css">
body,html { color:black; background:white; font-size:16px; padding:0; margin:0; } body,html { color:black; background:white; font-size:16px; padding:0; margin:0; }
#t1:-moz-read-only { display:none; } #t1:read-only { display:none; }
#t1:-moz-read-write { display:block; } #t1:read-write { display:block; }
#t2:-moz-read-write { display:none; } #t2:read-write { display:none; }
#t2:-moz-read-only { display:block; } #t2:read-only { display:block; }
#t3:disabled { display:none; } #t3:disabled { display:none; }
#t3:enabled { display:block; } #t3:enabled { display:block; }

View file

@ -9,17 +9,17 @@
cursor: text; cursor: text;
} }
*|*:-moz-read-write :-moz-read-only { *|*:read-write :read-only {
-moz-user-select: all; -moz-user-select: all;
} }
*|*:-moz-read-only > :-moz-read-write { *|*:read-only > :read-write {
/* override the above -moz-user-select: all rule. */ /* override the above -moz-user-select: all rule. */
-moz-user-select: -moz-text; -moz-user-select: -moz-text;
} }
input:-moz-read-write > .anonymous-div:-moz-read-only, input:read-write > .anonymous-div:read-only,
textarea:-moz-read-write > .anonymous-div:-moz-read-only { textarea:read-write > .anonymous-div:read-only {
-moz-user-select: text; -moz-user-select: text;
} }
@ -28,49 +28,49 @@ textarea:-moz-read-write > .anonymous-div:-moz-read-only {
Override the browser's pointer cursor over links Override the browser's pointer cursor over links
*/ */
img:-moz-read-write, img:-moz-read-write[usemap], area:-moz-read-write, img:read-write, img:read-write[usemap], area:read-write,
object:-moz-read-write, object:-moz-read-write[usemap], object:read-write, object:read-write[usemap],
applet:-moz-read-write, hr:-moz-read-write, button:-moz-read-write, applet:read-write, hr:read-write, button:read-write,
select:-moz-read-write, select:read-write,
a:-moz-read-write:link img, a:-moz-read-write:visited img, a:read-write:link img, a:read-write:visited img,
a:-moz-read-write:active img, a:-moz-read-write:-moz-only-whitespace[name] { a:read-write:active img, a:read-write:-moz-only-whitespace[name] {
cursor: default; cursor: default;
} }
*|*:any-link:-moz-read-write { *|*:any-link:read-write {
cursor: text; cursor: text;
} }
/* Prevent clicking on links from going to link */ /* Prevent clicking on links from going to link */
a:link:-moz-read-write img, a:visited:-moz-read-write img, a:link:read-write img, a:visited:read-write img,
a:active:-moz-read-write img { a:active:read-write img {
-moz-user-input: none; -moz-user-input: none;
} }
/* We suppress user/author's prefs for link underline, /* We suppress user/author's prefs for link underline,
so we must set explicitly. This isn't good! so we must set explicitly. This isn't good!
*/ */
a:link:-moz-read-write { a:link:read-write {
text-decoration: underline -moz-anchor-decoration; text-decoration: underline -moz-anchor-decoration;
color: -moz-hyperlinktext; color: -moz-hyperlinktext;
} }
/* Allow double-clicks on these widgets to open properties dialogs /* Allow double-clicks on these widgets to open properties dialogs
XXX except when the widget has disabled attribute */ XXX except when the widget has disabled attribute */
*|*:-moz-read-write > input:-moz-read-only, *|*:read-write > input:read-only,
*|*:-moz-read-write > button:-moz-read-only, *|*:read-write > button:read-only,
*|*:-moz-read-write > textarea:-moz-read-only { *|*:read-write > textarea:read-only {
-moz-user-select: all; -moz-user-select: all;
-moz-user-input: auto !important; -moz-user-input: auto !important;
-moz-user-focus: none !important; -moz-user-focus: none !important;
} }
/* XXX Still need a better way of blocking other events to these widgets */ /* XXX Still need a better way of blocking other events to these widgets */
select:-moz-read-write, select:read-write,
*|*:-moz-read-write > input:disabled, *|*:read-write > input:disabled,
*|*:-moz-read-write > input[type="checkbox"], *|*:read-write > input[type="checkbox"],
*|*:-moz-read-write > input[type="radio"], *|*:read-write > input[type="radio"],
*|*:-moz-read-write > input[type="file"], *|*:read-write > input[type="file"],
input[contenteditable="true"]:disabled, input[contenteditable="true"]:disabled,
input[contenteditable="true"][type="checkbox"], input[contenteditable="true"][type="checkbox"],
input[contenteditable="true"][type="radio"], input[contenteditable="true"][type="radio"],
@ -81,21 +81,21 @@ input[contenteditable="true"][type="file"] {
} }
/* emulation of non-standard HTML <marquee> tag */ /* emulation of non-standard HTML <marquee> tag */
marquee:-moz-read-write { marquee:read-write {
-moz-binding: url('chrome://xbl-marquee/content/xbl-marquee.xml#marquee-horizontal-editable'); -moz-binding: url('chrome://xbl-marquee/content/xbl-marquee.xml#marquee-horizontal-editable');
} }
marquee[direction="up"]:-moz-read-write, marquee[direction="down"]:-moz-read-write { marquee[direction="up"]:read-write, marquee[direction="down"]:read-write {
-moz-binding: url('chrome://xbl-marquee/content/xbl-marquee.xml#marquee-vertical-editable'); -moz-binding: url('chrome://xbl-marquee/content/xbl-marquee.xml#marquee-vertical-editable');
} }
*|*:-moz-read-write > input[type="hidden"], *|*:read-write > input[type="hidden"],
input[contenteditable="true"][type="hidden"] { input[contenteditable="true"][type="hidden"] {
border: 1px solid black !important; border: 1px solid black !important;
visibility: visible !important; visibility: visible !important;
} }
label:-moz-read-write { label:read-write {
-moz-user-select: all; -moz-user-select: all;
} }
@ -103,7 +103,7 @@ label:-moz-read-write {
-moz-user-select: text; -moz-user-select: text;
} }
option:-moz-read-write { option:read-write {
-moz-user-select: text; -moz-user-select: text;
} }

View file

@ -254,10 +254,10 @@ CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", 0, "", NS_EVENT_STATE_OUTOFR
CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", 0, "", NS_EVENT_STATE_DEFAULT) CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", 0, "", NS_EVENT_STATE_DEFAULT)
CSS_STATE_PSEUDO_CLASS(placeholderShown, ":placeholder-shown", 0, "", CSS_STATE_PSEUDO_CLASS(placeholderShown, ":placeholder-shown", 0, "",
NS_EVENT_STATE_PLACEHOLDERSHOWN) NS_EVENT_STATE_PLACEHOLDERSHOWN)
CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only", 0, "", CSS_STATE_PSEUDO_CLASS(readOnly, ":read-only", 0, "",
NS_EVENT_STATE_MOZ_READONLY) NS_EVENT_STATE_READONLY)
CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", 0, "", CSS_STATE_PSEUDO_CLASS(readWrite, ":read-write", 0, "",
NS_EVENT_STATE_MOZ_READWRITE) NS_EVENT_STATE_READWRITE)
CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", 0, "", CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", 0, "",
NS_EVENT_STATE_MOZ_SUBMITINVALID) NS_EVENT_STATE_MOZ_SUBMITINVALID)
CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", 0, "", CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", 0, "",

View file

@ -217,8 +217,8 @@ textarea::placeholder {
white-space: pre-wrap !important; white-space: pre-wrap !important;
} }
input:-moz-read-write, input:read-write,
textarea:-moz-read-write { textarea:read-write {
-moz-user-modify: read-write !important; -moz-user-modify: read-write !important;
} }