Changeset 150697 in webkit


Ignore:
Timestamp:
May 25, 2013 7:22:04 PM (11 years ago)
Author:
akling@apple.com
Message:

Move Node::focusDelegate() to Element.
<http://webkit.org/b/116768>

Reviewed by Anders Carlsson.

Only Element can be a focus delegate (it's currently only ever HTMLInputElement actually)
so move Node::focusDelegate() to Element. Sprinkled isElementNode() checks as needed.

  • dom/Node.cpp:
  • dom/Node.h:
  • dom/Element.h:
  • dom/Element.cpp:
  • html/shadow/SliderThumbElement.cpp:

(WebCore::SliderThumbElement::focusDelegate):

  • html/shadow/SliderThumbElement.h:
  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::isFocused):

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintSliderThumb):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150696 r150697  
     12013-05-25  Andreas Kling  <akling@apple.com>
     2
     3        Move Node::focusDelegate() to Element.
     4        <http://webkit.org/b/116768>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Only Element can be a focus delegate (it's currently only ever HTMLInputElement actually)
     9        so move Node::focusDelegate() to Element. Sprinkled isElementNode() checks as needed.
     10
     11        * dom/Node.cpp:
     12        * dom/Node.h:
     13        * dom/Element.h:
     14        * dom/Element.cpp:
     15        * html/shadow/SliderThumbElement.cpp:
     16        (WebCore::SliderThumbElement::focusDelegate):
     17        * html/shadow/SliderThumbElement.h:
     18        * rendering/RenderTheme.cpp:
     19        (WebCore::RenderTheme::isFocused):
     20        * rendering/RenderThemeMac.mm:
     21        (WebCore::RenderThemeMac::paintSliderThumb):
     22
    1232013-05-25  Alberto Garcia  <agarcia@igalia.com>
    224
  • trunk/Source/WebCore/dom/Element.cpp

    r150692 r150697  
    245245}
    246246
     247Element* Element::focusDelegate()
     248{
     249    return this;
     250}
     251
    247252short Element::tabIndex() const
    248253{
  • trunk/Source/WebCore/dom/Element.h

    r150692 r150697  
    436436    virtual bool isMouseFocusable() const;
    437437
     438    virtual Element* focusDelegate();
     439
    438440    RenderStyle* computedStyle(PseudoId = NOPSEUDO);
    439441
  • trunk/Source/WebCore/dom/Node.cpp

    r150692 r150697  
    886886}
    887887
    888 Node* Node::focusDelegate()
    889 {
    890     return this;
    891 }
    892 
    893888unsigned Node::nodeIndex() const
    894889{
  • trunk/Source/WebCore/dom/Node.h

    r150692 r150697  
    407407    // Whether the node can actually be focused.
    408408    virtual bool isFocusable() const;
    409     virtual Node* focusDelegate();
    410409
    411410    enum UserSelectAllTreatment {
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp

    r148545 r150697  
    238238}
    239239
    240 Node* SliderThumbElement::focusDelegate()
     240Element* SliderThumbElement::focusDelegate()
    241241{
    242242    return hostInput();
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.h

    r149960 r150697  
    6969    virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
    7070    virtual bool matchesReadWritePseudoClass() const OVERRIDE;
    71     virtual Node* focusDelegate();
     71    virtual Element* focusDelegate() OVERRIDE;
    7272    void startDragging();
    7373    void stopDragging();
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r150684 r150697  
    795795{
    796796    Node* node = o->node();
    797     if (!node)
    798         return false;
    799 
    800     node = node->focusDelegate();
    801     Document* document = node->document();
     797    if (!node || !node->isElementNode())
     798        return false;
     799
     800    Element* focusDelegate = toElement(node)->focusDelegate();
     801    Document* document = focusDelegate->document();
    802802    Frame* frame = document->frame();
    803     return node == document->focusedNode() && frame && frame->selection()->isFocusedAndActive();
     803    return focusDelegate == document->focusedNode() && frame && frame->selection()->isFocusedAndActive();
    804804}
    805805
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r149255 r150697  
    17631763    updateActiveState(sliderThumbCell, o);
    17641764    updateEnabledState(sliderThumbCell, o);
    1765     updateFocusedState(sliderThumbCell, (o->node() && o->node()->focusDelegate()->renderer()) ? o->node()->focusDelegate()->renderer() : o);
     1765    Element* focusDelegate = (o->node() && o->node()->isElementNode()) ? toElement(o->node())->focusDelegate() : 0;
     1766    updateFocusedState(sliderThumbCell, focusDelegate ? focusDelegate->renderer() : 0);
    17661767
    17671768    // Update the pressed state using the NSCell tracking methods, since that's how NSSliderCell keeps track of it.
Note: See TracChangeset for help on using the changeset viewer.