Changeset 56180 in webkit


Ignore:
Timestamp:
Mar 18, 2010 12:32:03 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-18 Luiz Agostini <luiz.agostini@openbossa.org>

Reviewed by Kenneth Rohde Christiansen.

Multiselect Popup - Listbox click simulation
https://bugs.webkit.org/show_bug.cgi?id=36177

Listbox popups will need to notify the corresponding select elements that a
selection change happened. The current HTMLSelectElement interface does not
allow multiple selections.

The new method listBoxSelectItem will be used for that. I have refactored part
of the mouse handling code in bug 36124 and I am now reusing it here for
<select multiple> popups. All the other cases will handled as they were before to be
sure that no side effects will show up.

  • dom/SelectElement.cpp: (WebCore::SelectElement::updateListBoxSelection): (WebCore::SelectElement::listBoxOnChange):
  • dom/SelectElement.h:
  • html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::listBoxPopupClick):
  • html/HTMLSelectElement.h:
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56175 r56180  
     12010-03-18  Luiz Agostini  <luiz.agostini@openbossa.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        Multiselect Popup - Listbox click simulation
     6        https://bugs.webkit.org/show_bug.cgi?id=36177
     7
     8        Listbox popups will need to notify the corresponding select elements that a
     9        selection change happened. The current HTMLSelectElement interface does not
     10        allow multiple selections.
     11
     12        The new method  listBoxSelectItem will be used for that. I have refactored part
     13        of the mouse handling code in bug 36124 and I am now reusing it here for
     14        <select multiple> popups. All the other cases will handled as they were before to be
     15        sure that no side effects will show up.
     16
     17        * dom/SelectElement.cpp:
     18        (WebCore::SelectElement::updateListBoxSelection):
     19        (WebCore::SelectElement::listBoxOnChange):
     20        * dom/SelectElement.h:
     21        * html/HTMLSelectElement.cpp:
     22        (WebCore::HTMLSelectElement::listBoxPopupClick):
     23        * html/HTMLSelectElement.h:
     24
    1252010-03-12  Ojan Vafai  <ojan@chromium.org>
    226
  • trunk/WebCore/dom/SelectElement.cpp

    r56120 r56180  
    151151void SelectElement::updateListBoxSelection(SelectElementData& data, Element* element, bool deselectOtherOptions)
    152152{
    153     ASSERT(element->renderer() && element->renderer()->isListBox());
     153    ASSERT(element->renderer() && (element->renderer()->isListBox() || data.multiple()));
    154154    ASSERT(data.activeSelectionAnchorIndex() >= 0);
    155155
     
    177177void SelectElement::listBoxOnChange(SelectElementData& data, Element* element)
    178178{
    179     ASSERT(!data.usesMenuList());
     179    ASSERT(!data.usesMenuList() || data.multiple());
    180180
    181181    Vector<bool>& lastOnChangeSelection = data.lastOnChangeSelection();
  • trunk/WebCore/dom/SelectElement.h

    r56116 r56180  
    11/*
     2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    23 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http//www.torchmobile.com/)
    34 *
     
    6061    virtual void setSelectedIndex(int index, bool deselect = true) = 0;
    6162    virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false) = 0;
     63
     64    virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) = 0;
    6265
    6366protected:
  • trunk/WebCore/html/HTMLSelectElement.cpp

    r55557 r56180  
    11/*
     2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    23 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    34 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
     
    9899}
    99100
     101void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
     102{
     103    if (!multiple())
     104        setSelectedIndexByUser(listIndex, true, fireOnChangeNow);
     105    else {
     106        updateSelectedState(m_data, this, listIndex, allowMultiplySelections, shift);
     107        if (fireOnChangeNow)
     108            listBoxOnChange();
     109    }
     110}
     111
    100112int HTMLSelectElement::activeSelectionStartListIndex() const
    101113{
  • trunk/WebCore/html/HTMLSelectElement.h

    r53957 r56180  
    11/*
     2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    23 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    34 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
     
    8182    void scrollToSelection();
    8283
     84    void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true);
     85
    8386private:
    8487    virtual int tagPriority() const { return 6; }
Note: See TracChangeset for help on using the changeset viewer.