Changeset 56285 in webkit


Ignore:
Timestamp:
Mar 19, 2010 5:08:32 PM (14 years ago)
Author:
eric@webkit.org
Message:

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

Reviewed by Antti Koivisto.

Multiselect Popup - PopupMenuClient extension
https://bugs.webkit.org/show_bug.cgi?id=36178

PopupMenuClient class is the interface used by combobox popup implementations.
It needs to be extended to handle <select multiple> needs.

A new interface named ListPopupMenuClient that inherits from PopupMenuClient was created.
The use of this new class instead of adding methods to PopupMenuClient avoids changes
in other non related implementations of PopupMenuClient.

RenderMenuList has changed to inherit ListPopupMenuClient instead of PopupMenuClient
and to have the new methods implemented.

  • platform/PopupMenuClient.h:
  • rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::listBoxSelectItem): (WebCore::RenderMenuList::multiple):
  • rendering/RenderMenuList.h:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56284 r56285  
     12010-03-19  Luiz Agostini  <luiz.agostini@openbossa.org>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        Multiselect Popup - PopupMenuClient extension
     6        https://bugs.webkit.org/show_bug.cgi?id=36178
     7
     8        PopupMenuClient class is the interface used by combobox popup implementations.
     9        It needs to be extended to handle <select multiple> needs.
     10
     11        A new interface named ListPopupMenuClient that inherits from PopupMenuClient was created.
     12        The use of this new class instead of adding methods to PopupMenuClient avoids changes
     13        in other non related implementations of PopupMenuClient.
     14
     15        RenderMenuList has changed to inherit ListPopupMenuClient instead of PopupMenuClient
     16        and to have the new methods implemented.
     17
     18        * platform/PopupMenuClient.h:
     19        * rendering/RenderMenuList.cpp:
     20        (WebCore::RenderMenuList::listBoxSelectItem):
     21        (WebCore::RenderMenuList::multiple):
     22        * rendering/RenderMenuList.h:
     23
    1242010-03-19  Simon Fraser  <simon.fraser@apple.com>
    225
  • trunk/WebCore/platform/PopupMenuClient.h

    r55425 r56285  
    11/*
     2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    23 * Copyright (C) 2006 Apple Computer, Inc.
    34 *
     
    6566};
    6667
     68#if ENABLE(NO_LISTBOX_RENDERING)
     69class ListPopupMenuClient : public PopupMenuClient {
     70public:
     71    virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) = 0;
     72    virtual bool multiple() = 0;
     73};
     74#endif
     75
     76
    6777}
    6878
  • trunk/WebCore/rendering/RenderMenuList.cpp

    r55425 r56285  
    22 * This file is part of the select element renderer in WebCore.
    33 *
     4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    45 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    56 *               2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
     
    310311}
    311312
     313#if ENABLE(NO_LISTBOX_RENDERING)
     314void RenderMenuList::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
     315{
     316    SelectElement* select = toSelectElement(static_cast<Element*>(node()));
     317    select->listBoxSelectItem(select->listToOptionIndex(listIndex), allowMultiplySelections, shift, fireOnChangeNow);
     318}
     319
     320bool RenderMenuList::multiple()
     321{
     322    SelectElement* select = toSelectElement(static_cast<Element*>(node()));
     323    return select->multiple();
     324}
     325#endif
     326
    312327void RenderMenuList::didSetSelectedIndex()
    313328{
  • trunk/WebCore/rendering/RenderMenuList.h

    r55425 r56285  
    22 * This file is part of the select element renderer in WebCore.
    33 *
     4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    45 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    56 *
     
    3839class RenderText;
    3940
     41#if ENABLE(NO_LISTBOX_RENDERING)
     42class RenderMenuList : public RenderFlexibleBox, private ListPopupMenuClient {
     43#else
    4044class RenderMenuList : public RenderFlexibleBox, private PopupMenuClient {
     45#endif
     46
    4147public:
    4248    RenderMenuList(Element*);
     
    98104    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
    99105
     106#if ENABLE(NO_LISTBOX_RENDERING)
     107    virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true);
     108    virtual bool multiple();
     109#endif
     110
    100111    virtual bool hasLineIfEmpty() const { return true; }
    101112
Note: See TracChangeset for help on using the changeset viewer.