Backed out changeset 0e94014166b3 (bug 1658302) for causing bug 1662483
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
#include "mozilla/dom/HTMLFormSubmission.h"
|
||||
#include "mozilla/dom/InputType.h"
|
||||
#include "mozilla/dom/UserActivation.h"
|
||||
#include "mozilla/dom/MutationEventBinding.h"
|
||||
#include "mozilla/dom/WheelEventBinding.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
@@ -1283,11 +1282,6 @@ nsresult HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
// Clear the cached @autocomplete attribute and autocompleteInfo state.
|
||||
mAutocompleteAttrState = nsContentUtils::eAutocompleteAttrState_Unknown;
|
||||
mAutocompleteInfoState = nsContentUtils::eAutocompleteAttrState_Unknown;
|
||||
} else if (aName == nsGkAtoms::placeholder) {
|
||||
// Full addition / removals of the attribute reconstruct right now.
|
||||
if (nsTextControlFrame* f = do_QueryFrame(GetPrimaryFrame())) {
|
||||
f->PlaceholderChanged(aOldValue, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatesDateTimeWidget()) {
|
||||
@@ -5130,47 +5124,24 @@ nsChangeHint HTMLInputElement::GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
nsChangeHint retval =
|
||||
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute,
|
||||
aModType);
|
||||
|
||||
const bool isAdditionOrRemoval =
|
||||
aModType == MutationEvent_Binding::ADDITION ||
|
||||
aModType == MutationEvent_Binding::REMOVAL;
|
||||
|
||||
const bool reconstruct = [&] {
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PlaceholderApplies() && aAttribute == nsGkAtoms::placeholder &&
|
||||
isAdditionOrRemoval) {
|
||||
// We need to re-create our placeholder text.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mType == NS_FORM_INPUT_FILE &&
|
||||
(aAttribute == nsGkAtoms::allowdirs ||
|
||||
aAttribute == nsGkAtoms::webkitdirectory)) {
|
||||
if (aAttribute == nsGkAtoms::type ||
|
||||
// The presence or absence of the 'directory' attribute determines what
|
||||
// value we show in the file label when empty, via GetDisplayFileName.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mType == NS_FORM_INPUT_IMAGE && isAdditionOrRemoval &&
|
||||
(aAttribute == nsGkAtoms::alt || aAttribute == nsGkAtoms::value)) {
|
||||
// We might need to rebuild our alt text. Just go ahead and
|
||||
// reconstruct our frame. This should be quite rare..
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
|
||||
if (reconstruct) {
|
||||
// buttons we show for type=file.
|
||||
aAttribute == nsGkAtoms::allowdirs ||
|
||||
aAttribute == nsGkAtoms::webkitdirectory) {
|
||||
retval |= nsChangeHint_ReconstructFrame;
|
||||
} else if (mType == NS_FORM_INPUT_IMAGE &&
|
||||
(aAttribute == nsGkAtoms::alt || aAttribute == nsGkAtoms::value)) {
|
||||
// We might need to rebuild our alt text. Just go ahead and
|
||||
// reconstruct our frame. This should be quite rare..
|
||||
retval |= nsChangeHint_ReconstructFrame;
|
||||
} else if (aAttribute == nsGkAtoms::value) {
|
||||
retval |= NS_STYLE_HINT_REFLOW;
|
||||
} else if (aAttribute == nsGkAtoms::size && IsSingleLineTextControl(false)) {
|
||||
retval |= NS_STYLE_HINT_REFLOW;
|
||||
} else if (PlaceholderApplies() && aAttribute == nsGkAtoms::placeholder) {
|
||||
retval |= nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -5906,7 +5877,8 @@ EventStates HTMLInputElement::IntrinsicState() const {
|
||||
}
|
||||
}
|
||||
|
||||
if (PlaceholderApplies() && HasAttr(nsGkAtoms::placeholder) &&
|
||||
if (PlaceholderApplies() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder) &&
|
||||
ShouldShowPlaceholder()) {
|
||||
state |= NS_EVENT_STATE_PLACEHOLDERSHOWN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user