Changeset 32664 in webkit


Ignore:
Timestamp:
Apr 28, 2008 6:18:52 PM (16 years ago)
Author:
alice.liu@apple.com
Message:

WebCore:

2008-04-28 Alice Liu <alice.liu@apple.com>

Reviewed by Darin.

Fix <rdar://problem/4911289> Add tabindex property to all children
of HTMLElement (7138)
http://bugs.webkit.org/show_bug.cgi?id=7138

Test: fast/events/tabindex-focus-blur-all.html

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/objc/DOMPrivate.h: -DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h are no longer needed
  • bindings/objc/PublicDOMInterfaces.h: -Moving focus, blur, tabindex to HTMLElement from its descendants.
  • dom/Node.cpp: (WebCore::Node::Node): (WebCore::Node::isFocusable): (WebCore::Node::isKeyboardFocusable): -The concept of being focusable now needs to account for tabindex attribute.
  • dom/Node.h: -Need to use a bit to keep track of whether tabindex was explicitly set to 0 or was just initialized to 0. (WebCore::Node::tabIndex): -Make this virtual so that Anchors and GenericFormElements can determine tabindex without accounting for focusability (WebCore::Node::setTabIndexExplicitly): -Renamed setTabIndex() to setTabIndexExplicitly() so as not to hide behind and/or be confused for HTMLElement::setTabIndex
  • html/HTMLAnchorElement.cpp:
  • html/HTMLAnchorElement.h: (WebCore::HTMLAnchorElement::tabIndex):
  • html/HTMLGenericFormElement.cpp:
  • html/HTMLGenericFormElement.h: (WebCore::HTMLGenericFormElement::tabIndex): -Anchors and form elements are normally focusable, and need to avert the check for focusability in HTMLElement::tabIndex because tabIndex could be queried before a first layout happens.
  • html/HTMLElement.cpp: (WebCore::HTMLElement::parseMappedAttribute): -Function Node::setTabIndex changed to Node::setTabIndexExplicitly (WebCore::HTMLElement::isFocusable): -The concept of being focusable now needs to account for tabindex attribute. (WebCore::HTMLElement::tabIndex): -HTML5 specifies that querying tabindex for elements that aren't focusable shall return -1 (WebCore::HTMLElement::setTabIndex): -New default implementation
  • html/HTMLElement.h:
  • html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::focus): -Now with HTML5's enhanced specification of tabindex, legend elements themselves shall focus (if they should), and not the first form element they encapsulate. This matches Firefox behavior. HTMLLabelElements still forward focus to the encapsulated element. This also matches other browsers.
  • html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::isFocusable):
  • html/HTMLAreaElement.h: -HTMLAreaElement isn't subject to the same focusability requirements as its parent, HTMLAnchorElement. Default HTMLElement implementation is desired.
  • html/HTMLFieldSetElement.cpp: (WebCore::HTMLFieldSetElement::isFocusable):
  • html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::isFocusable):
  • html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::isFocusable):
  • html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::isFocusable): -These elements aren't subject to the same focusability requirements as their parent, HTMLGenericFormElement. Default HTMLElement implementation is desired.
  • html/HTMLAnchorElement.idl:
  • html/HTMLAreaElement.idl:
  • html/HTMLButtonElement.idl:
  • html/HTMLElement.idl:
  • html/HTMLInputElement.idl:
  • html/HTMLLabelElement.idl:
  • html/HTMLLegendElement.idl:
  • html/HTMLObjectElement.idl:
  • html/HTMLSelectElement.idl:
  • html/HTMLTextAreaElement.idl: -Moving tabindex attribute, focus and blur methods from descendants of HTMLElement to HTMLElement

WebKit/mac:

2008-04-28 Alice Liu <alice.liu@apple.com>

Reviewed by Darin.

Fix <rdar://problem/4911289> Add tabindex property to all children
of HTMLElement (7138)
http://bugs.webkit.org/show_bug.cgi?id=7138

  • MigrateHeaders.make: Removing DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h because now that focus() has been moved to DOMHTMLElement.h, these files are no longer needed.

LayoutTests:

2008-04-28 Alice Liu <alice.liu@apple.com>

Reviewed by Sam Weinig.

Fix <rdar://problem/4911289> Add tabindex property to all children
of HTMLElement (7138)
http://bugs.webkit.org/show_bug.cgi?id=7138

minor updates to these existing tests:

  • fast/dom/domListEnumeration-expected.txt:
  • fast/dom/plugin-attributes-enumeration-expected.txt:
  • fast/dom/resources/domListEnumeration.js:
  • fast/events/resources/abe.png: Added.
  • fast/events/resources/tabindex-focus-blur-all-frame1.html: Added.
  • fast/events/resources/tabindex-focus-blur-all-frame2.html: Added.
  • fast/events/resources/tabindex-focus-blur-all-iframe1.html: Added.
  • fast/events/resources/tabindex-focus-blur-all-iframe2.html: Added.
  • fast/events/resources/tabindex-focus-blur-all.js: Added.
  • fast/events/tabindex-focus-blur-all-expected.txt: Added.
  • fast/events/tabindex-focus-blur-all.html: Added.
Location:
trunk
Files:
8 added
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r32660 r32664  
     12008-04-28  Alice Liu  <alice.liu@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Fix <rdar://problem/4911289> Add tabindex property to all children
     6        of HTMLElement (7138)
     7        http://bugs.webkit.org/show_bug.cgi?id=7138
     8
     9        minor updates to these existing tests:
     10        * fast/dom/domListEnumeration-expected.txt:
     11        * fast/dom/plugin-attributes-enumeration-expected.txt:
     12        * fast/dom/resources/domListEnumeration.js:
     13
     14        * fast/events/resources/abe.png: Added.
     15        * fast/events/resources/tabindex-focus-blur-all-frame1.html: Added.
     16        * fast/events/resources/tabindex-focus-blur-all-frame2.html: Added.
     17        * fast/events/resources/tabindex-focus-blur-all-iframe1.html: Added.
     18        * fast/events/resources/tabindex-focus-blur-all-iframe2.html: Added.
     19        * fast/events/resources/tabindex-focus-blur-all.js: Added.
     20        * fast/events/tabindex-focus-blur-all-expected.txt: Added.
     21        * fast/events/tabindex-focus-blur-all.html: Added.
     22
    1232008-04-28  Dan Bernstein  <mitz@apple.com>
    224
  • trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt

    r31142 r32664  
    3333
    3434[object HTMLFormElement]
    35 PASS resultArray.length is 113
     35PASS resultArray.length is 114
    3636PASS resultArray[0].i is '0'
    3737PASS resultArray[0].item is document.getElementsByTagName('select')[0]
  • trunk/LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt

    r30635 r32664  
    1717hspace
    1818standby
    19 tabIndex
    2019type
    2120useMap
  • trunk/LayoutTests/fast/dom/resources/domListEnumeration.js

    r31142 r32664  
    131131var htmlFormElement = document.getElementsByTagName('form')[0];
    132132resultArray = iterateList(htmlFormElement);
    133 shouldBe("resultArray.length", "113");
     133shouldBe("resultArray.length", "114");
    134134shouldBe("resultArray[0].i", "'0'");
    135135shouldBe("resultArray[0].item", "document.getElementsByTagName('select')[0]");
  • trunk/WebCore/ChangeLog

    r32660 r32664  
     12008-04-28  Alice Liu  <alice.liu@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        Fix <rdar://problem/4911289> Add tabindex property to all children
     6        of HTMLElement (7138)
     7        http://bugs.webkit.org/show_bug.cgi?id=7138
     8
     9        Test: fast/events/tabindex-focus-blur-all.html
     10
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * bindings/objc/DOMPrivate.h:
     13        -DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h are no
     14         longer needed
     15
     16        * bindings/objc/PublicDOMInterfaces.h:
     17        -Moving focus, blur, tabindex to HTMLElement from its descendants.
     18
     19        * dom/Node.cpp:
     20        (WebCore::Node::Node):
     21        (WebCore::Node::isFocusable):
     22        (WebCore::Node::isKeyboardFocusable):
     23        -The concept of being focusable now needs to account for tabindex
     24        attribute.
     25
     26        * dom/Node.h:
     27        -Need to use a bit to keep track of whether tabindex was explicitly set
     28         to 0 or was just initialized to 0.
     29        (WebCore::Node::tabIndex):
     30        -Make this virtual so that Anchors and GenericFormElements can determine
     31         tabindex without accounting for focusability
     32        (WebCore::Node::setTabIndexExplicitly):
     33        -Renamed setTabIndex() to setTabIndexExplicitly() so as not to hide
     34         behind and/or be confused for HTMLElement::setTabIndex
     35
     36        * html/HTMLAnchorElement.cpp:
     37        * html/HTMLAnchorElement.h:
     38        (WebCore::HTMLAnchorElement::tabIndex):
     39        * html/HTMLGenericFormElement.cpp:
     40        * html/HTMLGenericFormElement.h:
     41        (WebCore::HTMLGenericFormElement::tabIndex):
     42        -Anchors and form elements are normally focusable, and need to avert the
     43         check for focusability in HTMLElement::tabIndex
     44         because tabIndex could be queried before a first layout happens.
     45
     46        * html/HTMLElement.cpp:
     47        (WebCore::HTMLElement::parseMappedAttribute):
     48        -Function Node::setTabIndex changed to Node::setTabIndexExplicitly
     49        (WebCore::HTMLElement::isFocusable):
     50        -The concept of being focusable now needs to account for tabindex
     51         attribute.
     52        (WebCore::HTMLElement::tabIndex):
     53        -HTML5 specifies that querying tabindex for elements that aren't
     54         focusable shall return -1
     55        (WebCore::HTMLElement::setTabIndex):
     56        -New default implementation
     57        * html/HTMLElement.h:
     58
     59        * html/HTMLLegendElement.cpp:
     60        (WebCore::HTMLLegendElement::focus):
     61        -Now with HTML5's enhanced specification of tabindex, legend elements
     62         themselves shall focus (if they should), and not the first form element
     63         they encapsulate.  This matches Firefox behavior.  HTMLLabelElements
     64         still forward focus to the encapsulated element.  This also matches
     65         other browsers.
     66
     67        * html/HTMLAreaElement.cpp:
     68        (WebCore::HTMLAreaElement::isFocusable):
     69        * html/HTMLAreaElement.h:
     70        -HTMLAreaElement isn't subject to the same focusability requirements as
     71         its parent, HTMLAnchorElement. Default HTMLElement implementation is
     72         desired. 
     73
     74        * html/HTMLFieldSetElement.cpp:
     75        (WebCore::HTMLFieldSetElement::isFocusable):
     76        * html/HTMLLegendElement.cpp:
     77        (WebCore::HTMLLegendElement::isFocusable):
     78        * html/HTMLOptGroupElement.cpp:
     79        (WebCore::HTMLOptGroupElement::isFocusable):
     80        * html/HTMLOptionElement.cpp:
     81        (WebCore::HTMLOptionElement::isFocusable):
     82        -These elements aren't subject to the same focusability requirements as
     83         their parent, HTMLGenericFormElement. Default HTMLElement
     84         implementation is desired. 
     85
     86        * html/HTMLAnchorElement.idl:
     87        * html/HTMLAreaElement.idl:
     88        * html/HTMLButtonElement.idl:
     89        * html/HTMLElement.idl:
     90        * html/HTMLInputElement.idl:
     91        * html/HTMLLabelElement.idl:
     92        * html/HTMLLegendElement.idl:
     93        * html/HTMLObjectElement.idl:
     94        * html/HTMLSelectElement.idl:
     95        * html/HTMLTextAreaElement.idl:
     96        -Moving tabindex attribute, focus and blur methods from descendants of
     97         HTMLElement to HTMLElement
     98
    1992008-04-28  Dan Bernstein  <mitz@apple.com>
    2100
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r32586 r32664  
    356356                1CFCEE970AACC40100348750 /* DOMHTMLButtonElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE8E0AACC3CD00348750 /* DOMHTMLButtonElementPrivate.h */; };
    357357                1CFCEE980AACC40100348750 /* DOMHTMLImageElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE8F0AACC3CD00348750 /* DOMHTMLImageElementPrivate.h */; };
    358                 1CFCEE990AACC40100348750 /* DOMHTMLLabelElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE900AACC3CD00348750 /* DOMHTMLLabelElementPrivate.h */; };
    359                 1CFCEE9A0AACC40100348750 /* DOMHTMLLegendElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE910AACC3CD00348750 /* DOMHTMLLegendElementPrivate.h */; };
    360358                1CFCEE9B0AACC40100348750 /* DOMHTMLLinkElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE920AACC3CD00348750 /* DOMHTMLLinkElementPrivate.h */; };
    361359                1CFCEE9D0AACC40100348750 /* DOMHTMLStyleElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CFCEE940AACC3CD00348750 /* DOMHTMLStyleElementPrivate.h */; };
     
    40924090                                85BA4D2B0AA6889F0088052D /* DOMHTMLLIElement.h in Copy Generated Headers */,
    40934091                                85BA4CE70AA686510088052D /* DOMHTMLLabelElement.h in Copy Generated Headers */,
    4094                                 1CFCEE990AACC40100348750 /* DOMHTMLLabelElementPrivate.h in Copy Generated Headers */,
    40954092                                85BA4CE80AA686510088052D /* DOMHTMLLegendElement.h in Copy Generated Headers */,
    4096                                 1CFCEE9A0AACC40100348750 /* DOMHTMLLegendElementPrivate.h in Copy Generated Headers */,
    40974093                                8575DF860AA6130E00F5DBB5 /* DOMHTMLLinkElement.h in Copy Generated Headers */,
    40984094                                1CFCEE9B0AACC40100348750 /* DOMHTMLLinkElementPrivate.h in Copy Generated Headers */,
     
    48124808                1CFCEE8E0AACC3CD00348750 /* DOMHTMLButtonElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLButtonElementPrivate.h; sourceTree = "<group>"; };
    48134809                1CFCEE8F0AACC3CD00348750 /* DOMHTMLImageElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLImageElementPrivate.h; sourceTree = "<group>"; };
    4814                 1CFCEE900AACC3CD00348750 /* DOMHTMLLabelElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLLabelElementPrivate.h; sourceTree = "<group>"; };
    4815                 1CFCEE910AACC3CD00348750 /* DOMHTMLLegendElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLLegendElementPrivate.h; sourceTree = "<group>"; };
    48164810                1CFCEE920AACC3CD00348750 /* DOMHTMLLinkElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLLinkElementPrivate.h; sourceTree = "<group>"; };
    48174811                1CFCEE940AACC3CD00348750 /* DOMHTMLStyleElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLStyleElementPrivate.h; sourceTree = "<group>"; };
     
    98559849                                85BA4CD90AA6861B0088052D /* DOMHTMLLabelElement.h */,
    98569850                                85BA4CDA0AA6861B0088052D /* DOMHTMLLabelElement.mm */,
    9857                                 1CFCEE900AACC3CD00348750 /* DOMHTMLLabelElementPrivate.h */,
    98589851                                85BA4CDB0AA6861B0088052D /* DOMHTMLLegendElement.h */,
    98599852                                85BA4CDC0AA6861B0088052D /* DOMHTMLLegendElement.mm */,
    9860                                 1CFCEE910AACC3CD00348750 /* DOMHTMLLegendElementPrivate.h */,
    98619853                                85BA4D030AA688680088052D /* DOMHTMLLIElement.h */,
    98629854                                85BA4D040AA688680088052D /* DOMHTMLLIElement.mm */,
  • trunk/WebCore/bindings/objc/DOMPrivate.h

    r24771 r32664  
    4848#import <WebCore/DOMHTMLImageElementPrivate.h>
    4949#import <WebCore/DOMHTMLInputElementPrivate.h>
    50 #import <WebCore/DOMHTMLLabelElementPrivate.h>
    51 #import <WebCore/DOMHTMLLegendElementPrivate.h>
    5250#import <WebCore/DOMHTMLLinkElementPrivate.h>
    5351#import <WebCore/DOMHTMLOptionsCollectionPrivate.h>
  • trunk/WebCore/bindings/objc/PublicDOMInterfaces.h

    r29663 r32664  
    179179- (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
    180180- (BOOL)hasAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName;
    181 - (void)focus;
    182 - (void)blur;
    183181- (void)scrollIntoView:(BOOL)alignWithTop;
    184182- (void)scrollIntoViewIfNeeded:(BOOL)centerIfNeeded;
     
    268266@property(copy) NSString *rev;
    269267@property(copy) NSString *shape;
    270 @property int tabIndex;
    271268@property(copy) NSString *target;
    272269@property(copy) NSString *type;
    273270@property(readonly, copy) NSURL *absoluteLinkURL;
    274 - (void)blur;
    275 - (void)focus;
    276271@end
    277272
     
    297292@property BOOL noHref;
    298293@property(copy) NSString *shape;
    299 @property int tabIndex;
    300294@property(copy) NSString *target;
    301295@property(readonly, copy) NSURL *absoluteLinkURL;
     
    331325@property BOOL disabled;
    332326@property(copy) NSString *name;
    333 @property int tabIndex;
    334327@property(readonly, copy) NSString *type;
    335328@property(copy) NSString *value;
     
    380373@property(readonly) BOOL isContentEditable;
    381374@property(readonly, copy) NSString *titleDisplayString;
     375@property int tabIndex;
     376- (void)blur;
     377- (void)focus;
    382378@end
    383379
     
    496492@property(copy) NSString *size;
    497493@property(copy) NSString *src;
    498 @property int tabIndex;
    499494@property(copy) NSString *type;
    500495@property(copy) NSString *useMap;
     
    502497@property(readonly, copy) NSString *altDisplayString;
    503498@property(readonly, copy) NSURL *absoluteImageURL;
    504 - (void)blur;
    505 - (void)focus;
    506499- (void)select;
    507500- (void)click;
     
    589582@property(copy) NSString *name;
    590583@property(copy) NSString *standby;
    591 @property int tabIndex;
    592584@property(copy) NSString *type;
    593585@property(copy) NSString *useMap;
     
    660652@property(copy) NSString *name;
    661653@property int size;
    662 @property int tabIndex;
    663654- (void)add:(DOMHTMLElement *)element :(DOMHTMLElement *)before;
    664655- (void)add:(DOMHTMLElement *)element before:(DOMHTMLElement *)before;
    665656- (void)remove:(int)index;
    666 - (void)blur;
    667 - (void)focus;
    668657@end
    669658
     
    762751@property BOOL readOnly;
    763752@property int rows;
    764 @property int tabIndex;
    765753@property(readonly, copy) NSString *type;
    766754@property(copy) NSString *value;
    767 - (void)blur;
    768 - (void)focus;
    769755- (void)select;
    770756@end
  • trunk/WebCore/dom/Node.cpp

    r31767 r32664  
    4242#include "Frame.h"
    4343#include "HTMLNames.h"
    44 #include "HTMLNames.h"
    4544#include "Logging.h"
    4645#include "NameNodeList.h"
     
    138137      m_inActiveChain(false),
    139138      m_inDetach(false),
    140       m_inSubtreeMark(false)
     139      m_inSubtreeMark(false),
     140      m_tabIndexSetExplicitly(false)
    141141{
    142142#ifndef NDEBUG
     
    390390bool Node::isFocusable() const
    391391{
    392     return false;
     392    return m_tabIndexSetExplicitly;
    393393}
    394394
    395395bool Node::isKeyboardFocusable(KeyboardEvent*) const
    396396{
    397     return isFocusable();
     397    return isFocusable() && m_tabIndex >= 0;
    398398}
    399399
  • trunk/WebCore/dom/Node.h

    r31767 r32664  
    252252    virtual void setHovered(bool b = true) { m_hovered = b; }
    253253
    254     short tabIndex() const { return m_tabIndex; }
    255     void setTabIndex(short i) { m_tabIndex = i; }
     254    virtual short tabIndex() const { return m_tabIndex; }
    256255
    257256    /**
     
    470469    Node* m_next;
    471470    RenderObject* m_renderer;
     471    short m_tabIndex;
    472472
    473473protected:
     
    476476   
    477477    virtual void getSubresourceAttributeStrings(Vector<String>&) const { }
     478    void setTabIndexExplicitly(short i)
     479    {
     480        m_tabIndex = i;
     481        m_tabIndexSetExplicitly = true;
     482    }
    478483
    479484    OwnPtr<NodeListsNodeData> m_nodeLists;
    480 
    481     short m_tabIndex;
    482485
    483486    // make sure we don't use more than 16 bits here -- adding more would increase the size of all Nodes
     
    501504public:
    502505    bool m_inSubtreeMark : 1;
    503     // 1 bit left
    504506
    505507private:
     508    bool m_tabIndexSetExplicitly : 1;
     509    // no bits left
     510
    506511    Element* ancestorElement() const;
    507512
  • trunk/WebCore/html/HTMLAnchorElement.cpp

    r31405 r32664  
    392392}
    393393
     394short HTMLAnchorElement::tabIndex() const
     395{
     396    return Element::tabIndex();
     397}
     398   
    394399void HTMLAnchorElement::setTabIndex(int tabIndex)
    395400{
  • trunk/WebCore/html/HTMLAnchorElement.h

    r30243 r32664  
    7777    void setShape(const String&);
    7878
     79    short tabIndex() const;
    7980    void setTabIndex(int);
    8081
  • trunk/WebCore/html/HTMLAnchorElement.idl

    r29672 r32664  
    3535        attribute [ConvertNullToNullString] DOMString rev;
    3636        attribute [ConvertNullToNullString] DOMString shape;
    37         attribute long tabIndex;
    3837        attribute [ConvertNullToNullString] DOMString target;
    3938        attribute [ConvertNullToNullString] DOMString type;
    40 
    41         void blur();
    42         void focus();
    4339
    4440        // IE Extensions
  • trunk/WebCore/html/HTMLAreaElement.cpp

    r30243 r32664  
    214214}
    215215
     216bool HTMLAreaElement::isFocusable() const
     217{
     218    return HTMLElement::isFocusable();
     219}
     220
    216221String HTMLAreaElement::target() const
    217222{
  • trunk/WebCore/html/HTMLAreaElement.h

    r30243 r32664  
    6767
    6868    void setTabIndex(int);
     69    bool isFocusable() const;
    6970
    7071    virtual String target() const;
  • trunk/WebCore/html/HTMLAreaElement.idl

    r29672 r32664  
    3232        attribute boolean noHref;
    3333        attribute [ConvertNullToNullString] DOMString shape;
    34         attribute long tabIndex;
    3534        attribute [ConvertNullToNullString] DOMString target;
    3635
  • trunk/WebCore/html/HTMLButtonElement.idl

    r29672 r32664  
    3030                 attribute  boolean              disabled;
    3131                 attribute  [ConvertNullToNullString] DOMString            name;
    32                  attribute  long                 tabIndex;
    3332        readonly attribute  DOMString            type;
    3433                 attribute  [ConvertNullToNullString] DOMString            value;
  • trunk/WebCore/html/HTMLElement.cpp

    r31435 r32664  
    146146        if (indexstring.length())
    147147            // Clamp tabindex to the range of 'short' to match Firefox's behavior.
    148             setTabIndex(max(static_cast<int>(std::numeric_limits<short>::min()), min(indexstring.toInt(), static_cast<int>(std::numeric_limits<short>::max()))));
     148            setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(indexstring.toInt(), static_cast<int>(std::numeric_limits<short>::max()))));
    149149    } else if (attr->name() == langAttr) {
    150150        // FIXME: Implement
     
    526526bool HTMLElement::isFocusable() const
    527527{
    528     return isContentEditable() && parent() && !parent()->isContentEditable();
     528    return Element::isFocusable() || (isContentEditable() && parent() && !parent()->isContentEditable());
    529529}
    530530
     
    702702{
    703703    setAttribute(classAttr, value);
     704}
     705
     706short HTMLElement::tabIndex() const
     707{
     708    if (supportsFocus())
     709        return Element::tabIndex();
     710    return -1;
     711}
     712
     713void HTMLElement::setTabIndex(int value)
     714{
     715    setAttribute(tabindexAttr, String::number(value));
    704716}
    705717
  • trunk/WebCore/html/HTMLElement.h

    r25754 r32664  
    6060    String className() const;
    6161    void setClassName(const String&);
     62    short tabIndex() const;
     63    void setTabIndex(int);
    6264
    6365    String innerHTML() const;
  • trunk/WebCore/html/HTMLElement.idl

    r29672 r32664  
    3636                 attribute [ConvertNullToNullString] DOMString className;
    3737
     38                 attribute long            tabIndex;
     39                 void                      blur();
     40                 void                      focus();
     41
    3842        // Extensions
    3943                 attribute [ConvertNullToNullString] DOMString innerHTML
  • trunk/WebCore/html/HTMLFieldSetElement.cpp

    r25754 r32664  
    5151bool HTMLFieldSetElement::isFocusable() const
    5252{
    53     return false;
     53    return HTMLElement::isFocusable();
    5454}
    5555
  • trunk/WebCore/html/HTMLGenericFormElement.cpp

    r30112 r32664  
    206206    setAttribute(tabindexAttr, String::number(value));
    207207}
     208
     209short HTMLGenericFormElement::tabIndex() const
     210{
     211    return Element::tabIndex();
     212}
    208213   
    209214bool HTMLGenericFormElement::supportsFocus() const
  • trunk/WebCore/html/HTMLGenericFormElement.h

    r30112 r32664  
    9090
    9191    void setTabIndex(int);
     92    short tabIndex() const;
    9293
    9394    void formDestroyed() { m_form = 0; }
  • trunk/WebCore/html/HTMLInputElement.idl

    r29672 r32664  
    4646#endif
    4747                 attribute [ConvertNullToNullString] DOMString src;
    48                  attribute long            tabIndex;
    4948                 attribute [ConvertNullToNullString] DOMString type; // readonly dropped as part of DOM level 2
    5049                 attribute [ConvertNullToNullString] DOMString useMap;
    5150                 attribute [ConvertNullToNullString] DOMString value;
    5251       
    53         void               blur();
    54         void               focus();
    5552        void               select();
    5653        void               click();
  • trunk/WebCore/html/HTMLLabelElement.idl

    r29672 r32664  
    2929        attribute [ConvertNullToNullString] DOMString accessKey;
    3030        attribute [ConvertNullToNullString] DOMString htmlFor;
    31 
    32         void focus();
    3331    };
    3432
  • trunk/WebCore/html/HTMLLegendElement.cpp

    r25754 r32664  
    4646bool HTMLLegendElement::isFocusable() const
    4747{
    48     return false;
     48    return HTMLElement::isFocusable();
    4949}
    5050
     
    108108void HTMLLegendElement::focus(bool)
    109109{
     110    if (isFocusable())
     111        Element::focus();
     112       
    110113    // to match other browsers, never restore previous selection
    111114    if (Element *element = formElement())
  • trunk/WebCore/html/HTMLLegendElement.idl

    r29672 r32664  
    2929        attribute [ConvertNullToNullString] DOMString accessKey;
    3030        attribute [ConvertNullToNullString] DOMString align;
    31 
    32         void focus();
    3331    };
    3432
  • trunk/WebCore/html/HTMLObjectElement.idl

    r29672 r32664  
    4343                 attribute [ConvertNullToNullString] DOMString       name;
    4444                 attribute [ConvertNullToNullString] DOMString       standby;
    45                  attribute long            tabIndex;
    4645                 attribute [ConvertNullToNullString] DOMString       type;
    4746                 attribute [ConvertNullToNullString] DOMString       useMap;
  • trunk/WebCore/html/HTMLOptGroupElement.cpp

    r30633 r32664  
    4444bool HTMLOptGroupElement::isFocusable() const
    4545{
    46     return false;
     46    return HTMLElement::isFocusable();
    4747}
    4848
  • trunk/WebCore/html/HTMLOptionElement.cpp

    r30633 r32664  
    7676bool HTMLOptionElement::isFocusable() const
    7777{
    78     return false;
     78    return HTMLElement::isFocusable();
    7979}
    8080
  • trunk/WebCore/html/HTMLSelectElement.idl

    r29672 r32664  
    5050                 attribute [ConvertNullToNullString] DOMString       name;
    5151                 attribute long            size;
    52                  attribute long            tabIndex;
    5352       
    5453        [OldStyleObjC] void add(in HTMLElement element,
     
    6261        void               remove(in long index);
    6362#endif
    64         void               blur();
    65         void               focus();
    6663
    6764        // These methods are not in DOM Level 2 IDL, but are mentioned in the standard:
  • trunk/WebCore/html/HTMLTextAreaElement.idl

    r29672 r32664  
    3434                 attribute  boolean              readOnly;
    3535                 attribute  long                 rows;
    36                  attribute  long                 tabIndex;
    3736        readonly attribute  DOMString            type;
    3837                 attribute  [ConvertNullToNullString] DOMString            value;
    3938       
    40         void     blur();
    41         void     focus();
    4239        void     select();
    4340
  • trunk/WebKit/mac/ChangeLog

    r32652 r32664  
     12008-04-28  Alice Liu  <alice.liu@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        Fix <rdar://problem/4911289> Add tabindex property to all children
     6        of HTMLElement (7138)
     7        http://bugs.webkit.org/show_bug.cgi?id=7138
     8
     9        * MigrateHeaders.make:
     10        Removing DOMHTMLLabelElementPrivate.h and DOMHTMLLegendElementPrivate.h
     11        because now that focus() has been moved to DOMHTMLElement.h, these
     12        files are no longer needed.
     13
    1142008-04-25  Alexey Proskuryakov  <ap@webkit.org>
    215
  • trunk/WebKit/mac/MigrateHeaders.make

    r31321 r32664  
    125125    $(PUBLIC_HEADERS_DIR)/DOMHTMLLIElement.h \
    126126    $(PUBLIC_HEADERS_DIR)/DOMHTMLLabelElement.h \
    127     $(PRIVATE_HEADERS_DIR)/DOMHTMLLabelElementPrivate.h \
    128127    $(PUBLIC_HEADERS_DIR)/DOMHTMLLegendElement.h \
    129     $(PRIVATE_HEADERS_DIR)/DOMHTMLLegendElementPrivate.h \
    130128    $(PUBLIC_HEADERS_DIR)/DOMHTMLLinkElement.h \
    131129    $(PRIVATE_HEADERS_DIR)/DOMHTMLLinkElementPrivate.h \
Note: See TracChangeset for help on using the changeset viewer.