Backed out changeset 088bb497b532 (bug 867950) for mochitest-1 failures.

This commit is contained in:
Ryan VanderMeulen 2013-05-02 11:15:50 -04:00
Родитель 3d38600873
Коммит d1954a4a47
1 изменённых файлов: 86 добавлений и 46 удалений

Просмотреть файл

@ -734,8 +734,17 @@ HTMLInputElement::Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const
nsresult rv = const_cast<HTMLInputElement*>(this)->CopyInnerTo(it);
NS_ENSURE_SUCCESS(rv, rv);
switch (GetValueMode()) {
case VALUE_MODE_VALUE:
switch (mType) {
case NS_FORM_INPUT_EMAIL:
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_PASSWORD:
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_URL:
case NS_FORM_INPUT_NUMBER:
case NS_FORM_INPUT_DATE:
case NS_FORM_INPUT_TIME:
case NS_FORM_INPUT_RANGE:
if (mValueChanged) {
// We don't have our default value anymore. Set our value on
// the clone.
@ -745,7 +754,7 @@ HTMLInputElement::Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const
it->SetValueInternal(value, false, true);
}
break;
case VALUE_MODE_FILENAME:
case NS_FORM_INPUT_FILE:
if (it->OwnerDoc()->IsStaticDocument()) {
// We're going to be used in print preview. Since the doc is static
// we can just grab the pretty string and use it as wallpaper
@ -755,15 +764,16 @@ HTMLInputElement::Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const
it->mFiles.AppendObjects(mFiles);
}
break;
case VALUE_MODE_DEFAULT_ON:
case NS_FORM_INPUT_RADIO:
case NS_FORM_INPUT_CHECKBOX:
if (mCheckedChanged) {
// We no longer have our original checked state. Set our
// checked state on the clone.
it->DoSetChecked(mChecked, false, true);
}
break;
case VALUE_MODE_DEFAULT:
if (mType == NS_FORM_INPUT_IMAGE && it->OwnerDoc()->IsStaticDocument()) {
case NS_FORM_INPUT_IMAGE:
if (it->OwnerDoc()->IsStaticDocument()) {
CreateStaticImageClone(it);
}
break;
@ -4460,36 +4470,53 @@ NS_IMETHODIMP
HTMLInputElement::SaveState()
{
nsRefPtr<HTMLInputElementState> inputState;
switch (GetValueMode()) {
case VALUE_MODE_DEFAULT_ON:
if (mCheckedChanged) {
inputState = new HTMLInputElementState();
inputState->SetChecked(mChecked);
switch (mType) {
case NS_FORM_INPUT_CHECKBOX:
case NS_FORM_INPUT_RADIO:
{
if (mCheckedChanged) {
inputState = new HTMLInputElementState();
inputState->SetChecked(mChecked);
}
break;
}
// Never save passwords in session history
case NS_FORM_INPUT_PASSWORD:
break;
case VALUE_MODE_FILENAME:
if (mFiles.Count()) {
inputState = new HTMLInputElementState();
inputState->SetFiles(mFiles);
case NS_FORM_INPUT_EMAIL:
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_URL:
case NS_FORM_INPUT_HIDDEN:
case NS_FORM_INPUT_NUMBER:
case NS_FORM_INPUT_DATE:
case NS_FORM_INPUT_TIME:
case NS_FORM_INPUT_RANGE:
{
if (mValueChanged) {
inputState = new HTMLInputElementState();
nsAutoString value;
GetValue(value);
DebugOnly<nsresult> rv =
nsLinebreakConverter::ConvertStringLineBreaks(
value,
nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent);
NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!");
inputState->SetValue(value);
}
break;
}
case NS_FORM_INPUT_FILE:
{
if (mFiles.Count()) {
inputState = new HTMLInputElementState();
inputState->SetFiles(mFiles);
}
break;
}
break;
case VALUE_MODE_VALUE:
// Never save passwords in session history such as unmodified inputs.
if (mType != NS_FORM_INPUT_PASSWORD && mValueChanged) {
inputState = new HTMLInputElementState();
nsAutoString value;
GetValue(value);
DebugOnly<nsresult> rv =
nsLinebreakConverter::ConvertStringLineBreaks(
value,
nsLinebreakConverter::eLinebreakPlatform,
nsLinebreakConverter::eLinebreakContent);
NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!");
inputState->SetValue(value);
}
break;
case VALUE_MODE_DEFAULT:
break;
}
nsresult rv = NS_OK;
@ -4633,24 +4660,37 @@ HTMLInputElement::RestoreState(nsPresState* aState)
(do_QueryInterface(aState->GetStateProperty()));
if (inputState) {
switch (GetValueMode()) {
case VALUE_MODE_DEFAULT_ON:
if (inputState->IsCheckedSet()) {
restoredCheckedState = true;
DoSetChecked(inputState->GetChecked(), true, true);
switch (mType) {
case NS_FORM_INPUT_CHECKBOX:
case NS_FORM_INPUT_RADIO:
{
if (inputState->IsCheckedSet()) {
restoredCheckedState = true;
DoSetChecked(inputState->GetChecked(), true, true);
}
break;
}
break;
case VALUE_MODE_FILENAME:
case NS_FORM_INPUT_EMAIL:
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_URL:
case NS_FORM_INPUT_HIDDEN:
case NS_FORM_INPUT_NUMBER:
case NS_FORM_INPUT_DATE:
case NS_FORM_INPUT_TIME:
case NS_FORM_INPUT_RANGE:
{
SetValueInternal(inputState->GetValue(), false, true);
break;
}
case NS_FORM_INPUT_FILE:
{
const nsCOMArray<nsIDOMFile>& files = inputState->GetFiles();
SetFiles(files, true);
break;
}
break;
case VALUE_MODE_VALUE:
SetValueInternal(inputState->GetValue(), false, true);
break;
case VALUE_MODE_DEFAULT:
break;
}
}