- fixed <rdar://problem/
3871669> no focus or blur methods on HTML button elements
* khtml/dom/html_form.cpp:
(HTMLButtonElement::focus):
(HTMLButtonElement::blur):
* khtml/dom/html_form.h:
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLElementFunction::tryCall):
* khtml/ecma/kjs_html.h:
(KJS::HTMLElement::):
* khtml/ecma/kjs_html.lut.h:
(KJS::):
* khtml/html/html_formimpl.cpp:
(DOM::HTMLButtonElementImpl::blur):
(DOM::HTMLButtonElementImpl::focus):
* khtml/html/html_formimpl.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8992
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-04-04 Vicki Murley <vicki@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3871669> no focus or blur methods on HTML button elements
+
+ * khtml/dom/html_form.cpp:
+ (HTMLButtonElement::focus):
+ (HTMLButtonElement::blur):
+ * khtml/dom/html_form.h:
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::HTMLElementFunction::tryCall):
+ * khtml/ecma/kjs_html.h:
+ (KJS::HTMLElement::):
+ * khtml/ecma/kjs_html.lut.h:
+ (KJS::):
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLButtonElementImpl::blur):
+ (DOM::HTMLButtonElementImpl::focus):
+ * khtml/html/html_formimpl.h:
+
=== WebCore-415 ===
2005-03-28 David Harrison <harrison@apple.com>
if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value);
}
+void HTMLButtonElement::focus( )
+{
+ if(impl)
+ ((HTMLButtonElementImpl*)impl)->focus();
+}
+
+void HTMLButtonElement::blur( )
+{
+ if(impl)
+ ((HTMLButtonElementImpl*)impl)->blur();
+}
+
long HTMLButtonElement::tabIndex() const
{
if(!impl) return 0;
* see @ref name
*/
void setName( const DOMString & );
-
+
/**
* Index that represents the element's position in the tabbing
* order. See the <a
* see @ref value
*/
void setValue( const DOMString & );
+
+ /**
+ * Removes keyboard focus from this element.
+ *
+ */
+ void blur ( );
+
+ /**
+ * Gives keyboard focus to this element.
+ *
+ */
+ void focus ( );
};
-
// --------------------------------------------------------------------------
class HTMLFieldSetElementImpl;
tabIndex KJS::HTMLElement::ButtonTabIndex DontDelete
type KJS::HTMLElement::ButtonType DontDelete|ReadOnly
value KJS::HTMLElement::ButtonValue DontDelete
+ blur KJS::HTMLElement::ButtonBlur DontDelete|Function 0
+ focus KJS::HTMLElement::ButtonFocus DontDelete|Function 0
@end
@begin HTMLLabelElementTable 3
form KJS::HTMLElement::LabelForm DontDelete|ReadOnly
}
}
break;
+ case ID_BUTTON: {
+ DOM::HTMLButtonElement button = element;
+
+ if (id == KJS::HTMLElement::ButtonBlur) {
+ button.blur();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::ButtonFocus) {
+ button.focus();
+ return Undefined();
+ }
+ }
+ break;
case ID_TEXTAREA: {
DOM::HTMLTextAreaElement textarea = element;
if (id == KJS::HTMLElement::TextAreaBlur) {
TextAreaAccessKey, TextAreaName, TextAreaDefaultValue, TextAreaSelect,
TextAreaCols, TextAreaDisabled, TextAreaForm, TextAreaType,
TextAreaTabIndex, TextAreaReadOnly, TextAreaRows, TextAreaValue,
- TextAreaBlur, TextAreaFocus, ButtonForm, ButtonTabIndex, ButtonName,
+ TextAreaBlur, TextAreaFocus, ButtonBlur, ButtonFocus, ButtonForm, ButtonTabIndex, ButtonName,
ButtonDisabled, ButtonAccessKey, ButtonType, ButtonValue, LabelHtmlFor,
LabelForm, LabelAccessKey, FieldSetForm, LegendForm, LegendAccessKey,
LegendAlign, UListType, UListCompact, OListStart, OListCompact,
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "form", KJS::HTMLElement::ButtonForm, DontDelete|ReadOnly, 0, &HTMLButtonElementTableEntries[7] },
- { "tabIndex", KJS::HTMLElement::ButtonTabIndex, DontDelete, 0, 0 },
+ { "tabIndex", KJS::HTMLElement::ButtonTabIndex, DontDelete, 0, &HTMLButtonElementTableEntries[9] },
{ "name", KJS::HTMLElement::ButtonName, DontDelete, 0, 0 },
- { "disabled", KJS::HTMLElement::ButtonDisabled, DontDelete, 0, 0 },
+ { "disabled", KJS::HTMLElement::ButtonDisabled, DontDelete, 0, &HTMLButtonElementTableEntries[10] },
{ "accessKey", KJS::HTMLElement::ButtonAccessKey, DontDelete, 0, 0 },
{ "type", KJS::HTMLElement::ButtonType, DontDelete|ReadOnly, 0, &HTMLButtonElementTableEntries[8] },
- { "value", KJS::HTMLElement::ButtonValue, DontDelete, 0, 0 }
+ { "value", KJS::HTMLElement::ButtonValue, DontDelete, 0, 0 },
+ { "blur", KJS::HTMLElement::ButtonBlur, DontDelete|Function, 0, 0 },
+ { "focus", KJS::HTMLElement::ButtonFocus, DontDelete|Function, 0, 0 }
};
-const struct HashTable HTMLButtonElementTable = { 2, 9, HTMLButtonElementTableEntries, 7 };
+const struct HashTable HTMLButtonElementTable = { 2, 11, HTMLButtonElementTableEntries, 7 };
} // namespace
return getAttribute(ATTR_TYPE);
}
+void HTMLButtonElementImpl::blur()
+{
+ if(getDocument()->focusNode() == this)
+ getDocument()->setFocusNode(0);
+}
+
+void HTMLButtonElementImpl::focus()
+{
+ getDocument()->setFocusNode(this);
+}
+
void HTMLButtonElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
{
switch(attr->id())
virtual void click(bool sendMouseEvents);
virtual void accessKeyAction(bool sendToAnyElement);
+ void blur();
+ void focus();
protected:
DOMString m_value;