mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 0d782874abea, 75571af38ce5 & bfd3a65c0feb (bug 673873) for increasing the failure rate of bug 702184
This commit is contained in:
parent
259fb15955
commit
019cfa6b7f
@ -1285,22 +1285,22 @@ nsHTMLInputElement::AfterSetFiles(bool aSetValueChanged)
|
||||
UpdateAllValidityStates(true);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLInputElement::FireChangeEventIfNeeded()
|
||||
{
|
||||
nsString value;
|
||||
GetValueInternal(value);
|
||||
|
||||
if (!IsSingleLineTextControl(false) || mFocusedValue.Equals(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dispatch the change event.
|
||||
mFocusedValue = value;
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
void
|
||||
nsHTMLInputElement::FireChangeEventIfNeeded()
|
||||
{
|
||||
nsString value;
|
||||
GetValueInternal(value);
|
||||
|
||||
if (!IsSingleLineTextControl(false) || mFocusedValue.Equals(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dispatch the change event.
|
||||
mFocusedValue = value;
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
}
|
||||
|
||||
const nsCOMArray<nsIDOMFile>&
|
||||
@ -3203,6 +3203,7 @@ nsHTMLInputElement::IntrinsicState() const
|
||||
}
|
||||
|
||||
if (PlaceholderApplies() && HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
|
||||
!nsContentUtils::IsFocusedContent((nsIContent*)(this)) &&
|
||||
IsValueEmpty()) {
|
||||
state |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
|
||||
}
|
||||
@ -4074,7 +4075,8 @@ nsHTMLInputElement::OnValueChanged(bool aNotify)
|
||||
// :-moz-placeholder pseudo-class may change when the value changes.
|
||||
// However, we don't want to waste cycles if the state doesn't apply.
|
||||
if (PlaceholderApplies() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
|
||||
!nsContentUtils::IsFocusedContent(this)) {
|
||||
UpdateState(aNotify);
|
||||
}
|
||||
}
|
||||
|
@ -1146,6 +1146,7 @@ nsHTMLTextAreaElement::IntrinsicState() const
|
||||
}
|
||||
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
|
||||
!nsContentUtils::IsFocusedContent((nsIContent*)(this)) &&
|
||||
IsValueEmpty()) {
|
||||
state |= NS_EVENT_STATE_MOZ_PLACEHOLDER;
|
||||
}
|
||||
@ -1514,7 +1515,8 @@ nsHTMLTextAreaElement::OnValueChanged(bool aNotify)
|
||||
UpdateValueMissingValidityState();
|
||||
|
||||
if (validBefore != IsValid() ||
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
|
||||
(HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)
|
||||
&& !nsContentUtils::IsFocusedContent((nsIContent*)(this)))) {
|
||||
UpdateState(aNotify);
|
||||
}
|
||||
}
|
||||
|
@ -1934,9 +1934,16 @@ nsTextEditorState::ValueWasChanged(bool aNotify)
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString valueString;
|
||||
GetValue(valueString, true);
|
||||
SetPlaceholderClass(valueString.IsEmpty(), aNotify);
|
||||
bool showPlaceholder = false;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
|
||||
if (!nsContentUtils::IsFocusedContent(content)) {
|
||||
// If the content is focused, we don't care about the changes because
|
||||
// the placeholder is going to be hidden/shown on blur.
|
||||
nsAutoString valueString;
|
||||
GetValue(valueString, true);
|
||||
showPlaceholder = valueString.IsEmpty();
|
||||
}
|
||||
SetPlaceholderClass(showPlaceholder, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -631,6 +631,21 @@ void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint)
|
||||
mScrollEvent.Revoke();
|
||||
|
||||
if (!aOn) {
|
||||
if (mUsePlaceholder) {
|
||||
PRInt32 textLength;
|
||||
GetTextLength(&textLength);
|
||||
|
||||
if (!textLength) {
|
||||
nsWeakFrame weakFrame(this);
|
||||
|
||||
txtCtrl->SetPlaceholderClass(true, true);
|
||||
|
||||
if (!weakFrame.IsAlive()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -638,6 +653,16 @@ void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint)
|
||||
if (!selCon)
|
||||
return;
|
||||
|
||||
if (mUsePlaceholder) {
|
||||
nsWeakFrame weakFrame(this);
|
||||
|
||||
txtCtrl->SetPlaceholderClass(false, true);
|
||||
|
||||
if (!weakFrame.IsAlive()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISelection> ourSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL,
|
||||
getter_AddRefs(ourSel));
|
||||
@ -1367,7 +1392,9 @@ nsTextControlFrame::SetValueChanged(bool aValueChanged)
|
||||
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
|
||||
NS_ASSERTION(txtCtrl, "Content not a text control element");
|
||||
|
||||
if (mUsePlaceholder) {
|
||||
if (mUsePlaceholder && !nsContentUtils::IsFocusedContent(mContent)) {
|
||||
// If the content is focused, we don't care about the changes because
|
||||
// the placeholder is going to be hidden/shown on blur.
|
||||
PRInt32 textLength;
|
||||
GetTextLength(&textLength);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html class='reftest-wait'>
|
||||
<link rel='stylesheet' type='text/css' href='style.css'>
|
||||
<script>
|
||||
function loadHandler()
|
||||
{
|
||||
@ -12,6 +11,6 @@
|
||||
}
|
||||
</script>
|
||||
<body onload='loadHandler();'>
|
||||
<input id='i' class='ref' value='foo' onfocus='focusHandler();'>
|
||||
<input id='i' onfocus='focusHandler();'>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,7 +1,7 @@
|
||||
input:-moz-placeholder,
|
||||
input.ref {
|
||||
-moz-appearance: none;
|
||||
color: -moz-FieldText;
|
||||
color: black;
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html class='reftest-wait'>
|
||||
<link rel='stylesheet' type='text/css' href='style.css'>
|
||||
<script>
|
||||
function loadHandler()
|
||||
{
|
||||
@ -12,6 +11,6 @@
|
||||
}
|
||||
</script>
|
||||
<body onload='loadHandler();'>
|
||||
<textarea id='t' class='ref' onfocus='focusHandler();'>foo</textarea>
|
||||
<textarea id='t' onfocus='focusHandler();'></textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,7 +1,7 @@
|
||||
textarea:-moz-placeholder,
|
||||
textarea.ref {
|
||||
-moz-appearance: none;
|
||||
color: -moz-FieldText;
|
||||
color: black;
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
|
18
layout/reftests/forms/placeholder/placeholder-15.html
Normal file
18
layout/reftests/forms/placeholder/placeholder-15.html
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<!-- Test: when focused, element should show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
document.getElementById('p1').focus();
|
||||
}
|
||||
function disableReftestWait()
|
||||
{
|
||||
document.documentElement.className = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<body onload="focusPlaceholder();">
|
||||
<input type="text" id="p1" value="" placeholder="my placeholder" onfocus="disableReftestWait();">
|
||||
</body>
|
||||
</html>
|
22
layout/reftests/forms/placeholder/placeholder-16.html
Normal file
22
layout/reftests/forms/placeholder/placeholder-16.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<!-- Test: when focused, placeholder update shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
document.getElementById('p1').focus();
|
||||
}
|
||||
function setPlaceholder()
|
||||
{
|
||||
document.getElementById('p1').placeholder = 'new placeholder';
|
||||
}
|
||||
function disableReftestWait()
|
||||
{
|
||||
document.documentElement.className = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<body onload="focusPlaceholder();">
|
||||
<input type="text" id="p1" value="" placeholder="my placeholder" onfocus="setPlaceholder(); disableReftestWait();">
|
||||
</body>
|
||||
</html>
|
22
layout/reftests/forms/placeholder/placeholder-17.html
Normal file
22
layout/reftests/forms/placeholder/placeholder-17.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<!-- Test: when focused, value reset shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
document.getElementById('p1').focus();
|
||||
}
|
||||
function resetValue()
|
||||
{
|
||||
document.getElementById('p1').value = '';
|
||||
}
|
||||
function disableReftestWait()
|
||||
{
|
||||
document.documentElement.className = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<body onload="focusPlaceholder();">
|
||||
<input type="text" id="p1" value="my value" placeholder="my placeholder" onfocus="resetValue(); disableReftestWait();">
|
||||
</body>
|
||||
</html>
|
@ -1,7 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<link rel='stylesheet' type='text/css' href='placeholder-style.css'>
|
||||
<!-- Test: when focused, if value='', newest placeholder should be shown. -->
|
||||
<!-- Test: when focused, placeholder update shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
@ -9,7 +8,7 @@
|
||||
}
|
||||
function setPlaceholder()
|
||||
{
|
||||
document.getElementById('p1').placeholder = 'my placeholder';
|
||||
document.getElementById('p1').placeholder = 'new placeholder';
|
||||
}
|
||||
function disableReftestWait()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<!-- Test: when focused, clearing placeholder attribute should work. -->
|
||||
<!-- Test: when focused, placeholder update shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<!-- Test: when focused, clearing placeholder attribute should work. -->
|
||||
<!-- Test: when focused, placeholder update shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<link rel='stylesheet' type='text/css' href='placeholder-style.css'>
|
||||
<!-- Test: when focused, element should show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
|
@ -1,7 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<link rel='stylesheet' type='text/css' href='placeholder-style.css'>
|
||||
<!-- Test: when focused, if value='', newest placeholder should be shown. -->
|
||||
<!-- Test: when focused, placeholder update shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
@ -9,7 +8,7 @@
|
||||
}
|
||||
function setPlaceholder()
|
||||
{
|
||||
document.getElementById('p1').placeholder = 'my placeholder';
|
||||
document.getElementById('p1').placeholder = 'new placeholder';
|
||||
}
|
||||
function disableReftestWait()
|
||||
{
|
||||
@ -18,6 +17,6 @@
|
||||
</script>
|
||||
|
||||
<body onload="focusPlaceholder();">
|
||||
<input type="text" id="p1" value="" placeholder="old placeholder" onfocus="setPlaceholder(); disableReftestWait();">
|
||||
<input type="text" id="p1" value="" placeholder="my placeholder" onfocus="setPlaceholder(); disableReftestWait();">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<link rel='stylesheet' type='text/css' href='placeholder-style.css'>
|
||||
<!-- Test: when focused, value reset should show placeholder. -->
|
||||
<!-- Test: when focused, value reset shouldn't show placeholder. -->
|
||||
<script type="text/javascript">
|
||||
function focusPlaceholder()
|
||||
{
|
||||
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script type="text/javascript">
|
||||
function focusInput()
|
||||
{
|
||||
document.getElementById('t1').focus();
|
||||
}
|
||||
function disableReftestWait()
|
||||
{
|
||||
document.documentElement.className = '';
|
||||
}
|
||||
</script>
|
||||
<body onload="focusInput();">
|
||||
<input id='t1' type="text" onfocus="disableReftestWait();">
|
||||
</body>
|
||||
</html>
|
@ -1,6 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<link rel='stylesheet' type='text/css' href='placeholder-style.css'>
|
||||
<script type="text/javascript">
|
||||
function focusInput()
|
||||
{
|
||||
@ -12,6 +11,6 @@
|
||||
}
|
||||
</script>
|
||||
<body onload="focusInput();">
|
||||
<input id='t1' type="text" class="placeholder" value="my placeholder" onfocus="disableReftestWait();">
|
||||
<input id='t1' type="text" onfocus="disableReftestWait();">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,9 +2,3 @@ textarea.placeholder,
|
||||
input.placeholder {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
/* workaround until :-moz-placeholder is re-implemented as a pseudo-element */
|
||||
textarea:focus,
|
||||
input:focus {
|
||||
color: -moz-FieldText;
|
||||
}
|
||||
|
@ -16,8 +16,11 @@ needs-focus == placeholder-10.html placeholder-visible-ref.html
|
||||
== placeholder-12.html placeholder-visible-ref.html
|
||||
== placeholder-13.html placeholder-visible-ref.html
|
||||
== placeholder-14.html placeholder-visible-ref.html
|
||||
needs-focus == placeholder-15.html placeholder-focus-ref.html
|
||||
needs-focus == placeholder-16.html placeholder-focus-ref.html
|
||||
needs-focus == placeholder-17.html placeholder-focus-ref.html
|
||||
== placeholder-18.html placeholder-overridden-ref.html
|
||||
== placeholder-19.xul placeholder-overridden-ref.xul
|
||||
needs-focus == placeholder-20.html placeholder-focus-ref.html
|
||||
needs-focus == placeholder-21.html placeholder-blank-ref.html
|
||||
needs-focus == placeholder-22.html placeholder-blank-ref.html
|
||||
needs-focus == placeholder-21.html placeholder-focus-ref.html
|
||||
needs-focus == placeholder-22.html placeholder-focus-ref.html
|
||||
|
@ -145,11 +145,6 @@ textarea:-moz-placeholder {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
input:-moz-placeholder > .anonymous-div:not(.placeholder),
|
||||
textarea:-moz-placeholder > .anonymous-div:not(.placeholder) {
|
||||
color: -moz-FieldText;
|
||||
}
|
||||
|
||||
input > .placeholder,
|
||||
textarea > .placeholder {
|
||||
overflow: hidden;
|
||||
|
Loading…
Reference in New Issue
Block a user