X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=WebCore%2Fkwq%2FDOMHTML.mm;h=c89ce9062ae40bd0b2e09e165a589490175b8a39;hp=1c756a20e82f6790f24c0ca5a1496c83809efe67;hb=6974dd089cc256cae718711ce22dfb84f3751ab5;hpb=369ded00281fcff898c8832a1aa02193ee7e3390;ds=sidebyside diff --git a/WebCore/kwq/DOMHTML.mm b/WebCore/kwq/DOMHTML.mm index 1c756a2..c89ce90 100644 --- a/WebCore/kwq/DOMHTML.mm +++ b/WebCore/kwq/DOMHTML.mm @@ -1462,6 +1462,40 @@ using DOM::NodeImpl; @end +@implementation DOMHTMLInputElement (DOMHTMLInputElementExtensions) + +- (BOOL)isTextField +{ + static NSArray *textInputTypes = nil; +#ifndef NDEBUG + static NSArray *nonTextInputTypes = nil; +#endif + + NSString *type = [self type]; + + // No type at all is treated as text type + if ([type length] == 0) + return YES; + + if (textInputTypes == nil) + textInputTypes = [[NSSet alloc] initWithObjects:@"text", @"password", @"search", nil]; + + BOOL isText = [textInputTypes containsObject:[type lowercaseString]]; + +#ifndef NDEBUG + if (nonTextInputTypes == nil) + nonTextInputTypes = [[NSSet alloc] initWithObjects:@"isindex", @"checkbox", @"radio", @"submit", @"reset", @"file", @"hidden", @"image", @"button", @"range", nil]; + + // Catch cases where a new input type has been added that's not in these lists. + ASSERT(isText || [nonTextInputTypes containsObject:[type lowercaseString]]); +#endif + + return isText; +} + +@end + + @implementation DOMHTMLTextAreaElement - (HTMLTextAreaElementImpl *)_textAreaElementImpl