nsresult HTMLTextAreaElement::Reset() {
  nsAutoString resetVal;
  GetDefaultValue(resetVal, IgnoreErrors());
  SetValueChanged(false);

  nsresult rv =
      SetValueInternal(resetVal, nsTextEditorState::eSetValue_Internal);
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
nsresult
HTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
                                      bool aUserInput)
{
  // Need to set the value changed flag here, so that
  // nsTextControlFrame::UpdateValueDisplay retrieves the correct value
  // if needed.
  SetValueChanged(true);
  mState.SetValue(aValue, aUserInput, true);

  return NS_OK;
}
Esempio n. 3
0
void LLDBVariable::DoInitFromLLDBValue(lldb::SBValue value)
{
    SetName(value.GetName());
    SetType(value.GetTypeName());
    SetSummary(value.GetSummary());
    SetValue(value.GetValue());
    SetValueChanged(value.GetValueDidChange());
    SetLldbId(value.GetID());

    if(value.MightHaveChildren()) {
        m_hasChildren = true;
    }
}
Esempio n. 4
0
nsresult
HTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
                                      uint32_t aFlags)
{
  // Need to set the value changed flag here, so that
  // nsTextControlFrame::UpdateValueDisplay retrieves the correct value
  // if needed.
  SetValueChanged(true);
  aFlags |= nsTextEditorState::eSetValue_Notify;
  if (!mState.SetValue(aValue, aFlags)) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  return NS_OK;
}
Esempio n. 5
0
nsresult
nsHTMLTextAreaElement::Reset()
{
  nsresult rv;
  // If the frame is there, we have to set the value so that it will show up.
  nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);
  if (formControlFrame) {
    nsAutoString resetVal;
    GetDefaultValue(resetVal);
    rv = SetValue(resetVal);
    NS_ENSURE_SUCCESS(rv, rv);
  }
  SetValueChanged(PR_FALSE);
  return NS_OK;
}
nsresult
HTMLTextAreaElement::Reset()
{
  nsresult rv;

  // To get the initial spellchecking, reset value to
  // empty string before setting the default value.
  SetValue(EmptyString());
  nsAutoString resetVal;
  GetDefaultValue(resetVal);
  rv = SetValue(resetVal);
  NS_ENSURE_SUCCESS(rv, rv);

  SetValueChanged(false);
  return NS_OK;
}
nsresult HTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
                                               uint32_t aFlags) {
  // Need to set the value changed flag here if our value has in fact changed
  // (i.e. if eSetValue_Notify is in aFlags), so that
  // nsTextControlFrame::UpdateValueDisplay retrieves the correct value if
  // needed.
  if (aFlags & nsTextEditorState::eSetValue_Notify) {
    SetValueChanged(true);
  }

  if (!mState.SetValue(aValue, aFlags)) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  return NS_OK;
}
Esempio n. 8
0
nsresult
nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
                                        nsITextControlFrame* aFrame,
                                        PRBool aUserInput)
{
  nsITextControlFrame* textControlFrame = aFrame;
  nsIFormControlFrame* formControlFrame = textControlFrame;
  if (!textControlFrame) {
    // No need to flush here, if there is no frame for this yet forcing
    // creation of one will not do us any good
    formControlFrame = GetFormControlFrame(PR_FALSE);

    if (formControlFrame) {
      textControlFrame = do_QueryFrame(formControlFrame);
    }
  }

  PRBool frameOwnsValue = PR_FALSE;
  if (textControlFrame) {
    textControlFrame->OwnsValue(&frameOwnsValue);
  }
  if (frameOwnsValue) {
    formControlFrame->SetFormProperty(
      aUserInput ? nsGkAtoms::userInput : nsGkAtoms::value, aValue);
  }
  else {
    if (mValue) {
      nsMemory::Free(mValue);
    }
    mValue = ToNewUTF8String(aValue);
    NS_ENSURE_TRUE(mValue, NS_ERROR_OUT_OF_MEMORY);

    SetValueChanged(PR_TRUE);
  }

  return NS_OK;
}