Moved the dispatch of the onChange to after where the property is set, this way it will have the "new" value

Removed macro impl of Set/GetSize and implemented it to notify the document that an attr has changd and the hint is reflow so when the size gets changed via script it changes size
b=50280,50436 r=kmcclusk
This commit is contained in:
rods%netscape.com 2000-08-29 01:50:31 +00:00
Родитель 8e2f31db68
Коммит 8507f2d98b
2 изменённых файлов: 60 добавлений и 18 удалений

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

@ -366,7 +366,6 @@ NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Disabled, disabled)
NS_IMPL_INT_ATTR(nsHTMLInputElement, MaxLength, maxlength)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Name, name)
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, ReadOnly, readonly)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Size, size)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Src, src)
NS_IMPL_INT_ATTR(nsHTMLInputElement, TabIndex, tabindex)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, UseMap, usemap)
@ -420,6 +419,28 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue)
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue);
}
NS_IMETHODIMP
nsHTMLInputElement::SetSize(const nsAReadableString& aValue)
{
nsresult rv = mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::size, aValue, PR_TRUE);
PRInt32 type;
GetType(&type);
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) {
if (mInner.mDocument) {
mInner.mDocument->AttributeChanged(this, kNameSpaceID_HTML, nsHTMLAtoms::size, NS_STYLE_HINT_REFLOW);
}
}
return rv;
}
NS_IMETHODIMP
nsHTMLInputElement::GetSize(nsAWritableString& aValue)
{
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::size, aValue);
}
NS_IMETHODIMP
nsHTMLInputElement::SetValue(const nsAReadableString& aValue)
@ -536,14 +557,6 @@ nsHTMLInputElement::SetChecked(PRBool aValue)
nsCOMPtr<nsIPresContext> presContext;
nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext));
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
event.eventStructType = NS_GUI_EVENT;
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
event.widget = nsnull;
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
nsIFormControlFrame* formControlFrame = nsnull;
if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) {
@ -597,6 +610,14 @@ nsHTMLInputElement::SetChecked(PRBool aValue)
}
}
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
event.eventStructType = NS_GUI_EVENT;
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
event.widget = nsnull;
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
return NS_OK;
}

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

@ -366,7 +366,6 @@ NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Disabled, disabled)
NS_IMPL_INT_ATTR(nsHTMLInputElement, MaxLength, maxlength)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Name, name)
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, ReadOnly, readonly)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Size, size)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Src, src)
NS_IMPL_INT_ATTR(nsHTMLInputElement, TabIndex, tabindex)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, UseMap, usemap)
@ -420,6 +419,28 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue)
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue);
}
NS_IMETHODIMP
nsHTMLInputElement::SetSize(const nsAReadableString& aValue)
{
nsresult rv = mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::size, aValue, PR_TRUE);
PRInt32 type;
GetType(&type);
if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) {
if (mInner.mDocument) {
mInner.mDocument->AttributeChanged(this, kNameSpaceID_HTML, nsHTMLAtoms::size, NS_STYLE_HINT_REFLOW);
}
}
return rv;
}
NS_IMETHODIMP
nsHTMLInputElement::GetSize(nsAWritableString& aValue)
{
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::size, aValue);
}
NS_IMETHODIMP
nsHTMLInputElement::SetValue(const nsAReadableString& aValue)
@ -536,14 +557,6 @@ nsHTMLInputElement::SetChecked(PRBool aValue)
nsCOMPtr<nsIPresContext> presContext;
nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext));
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
event.eventStructType = NS_GUI_EVENT;
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
event.widget = nsnull;
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
nsIFormControlFrame* formControlFrame = nsnull;
if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) {
@ -597,6 +610,14 @@ nsHTMLInputElement::SetChecked(PRBool aValue)
}
}
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
event.eventStructType = NS_GUI_EVENT;
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
event.widget = nsnull;
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
return NS_OK;
}