WebCore:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 05:47:30 +0000 (05:47 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 05:47:30 +0000 (05:47 +0000)
commite0a75033bccfa165058d82d7b7237619f517708c
tree831a2aab73f452fc2cfe29f4b165c6d68076fa9f
parent624981d9f4a2cf591d7a688e50840b5db2ea7063
WebCore:

        Reviewed by Maciej and Hyatt.

        Initial implementation of popup menu control.  This can be turned on by setting -webkit-appearance: menulist on a select element.

        * WebCore.xcodeproj/project.pbxproj: Added RenderMenuList.h, RenderMenuList.cpp, RenderPopupMenu.h, RenderPopupMenu.cpp,
        RenderPopupMenuWin.h, RenderPopupMenuMac.h, RenderPopupMenuMac.mm,

        * dom/Node.cpp:
        (WebCore::Node::renderStyle): Added. Returns the renderer's style.  If there's no renderer, returns's a RenderStyle that's kept by the node.
        This is important for HTMLOptGroupElement and HTMLOptionElement, which don't have renderers.
        (WebCore::Node::setRenderStyle): Added.
        * dom/Node.h:
        * dom/Element.cpp: (WebCore::Element::recalcStyle): Updated to use renderStyle so recalcStyle will work for HTMLOptionElements and HTMLOptGroupElements.

        * css/cssstyleselector.cpp: Updated to call renderStyle method on the node, so resolving style works on elements w/o renderers that cache style.
        (WebCore::CSSStyleSelector::initForStyleResolve):
        (WebCore::CSSStyleSelector::locateCousinList):
        (WebCore::CSSStyleSelector::canShareStyleWithElement):
        (WebCore::CSSStyleSelector::locateSharedStyle):
        (WebCore::CSSStyleSelector::checkOneSelector):

        * css/html4.css: Removed display:none from options and optgroups, since we're now caching style for these elements.
        Added font-weight styles for option and optgroup.

        * html/HTMLOptGroupElement.h: Added m_style to keep track of a RenderStyle for the element, even though we aren't creating a renderer.
        This will allow us to honor style for optgroups and options for popup menus (and eventually list boxes too).
        (WebCore::HTMLOptGroupElement::rendererIsNeeded): Added.
        (WebCore::HTMLOptGroupElement::renderStyle): Added.
        * html/HTMLOptionElement.h: ditto.
        (WebCore::HTMLOptionElement::rendererIsNeeded): Added.
        (WebCore::HTMLOptionElement::renderStyle): Added.

        * html/HTMLOptGroupElement.cpp:
        (WebCore::HTMLOptGroupElement::HTMLOptGroupElement): Initialize m_style.
        (WebCore::HTMLOptGroupElement::attach): Set the renderStyle.
        (WebCore::HTMLOptGroupElement::detach): Clear m_style.
        (WebCore::HTMLOptGroupElement::setRenderStyle): Added.
        (WebCore::HTMLOptGroupElement::groupLabelText): Added.
        * html/HTMLOptionElement.cpp: ditto.
        (WebCore::HTMLOptionElement::HTMLOptionElement):
        (WebCore::HTMLOptionElement::attach):
        (WebCore::HTMLOptionElement::detach):
        (WebCore::HTMLOptionElement::setRenderStyle):
        (WebCore::HTMLOptionElement::optionText):

        * html/HTMLSelectElement.cpp: Added code to use the new RenderMenuList if the appearance is set to MenuListAppearance,
        and if we're not creating a list box renderer.
        (WebCore::HTMLSelectElement::recalcStyle):
        (WebCore::HTMLSelectElement::createRenderer):
        (WebCore::HTMLSelectElement::setRecalcListItems):
        (WebCore::HTMLSelectElement::reset):
        (WebCore::HTMLSelectElement::notifyOptionSelected):
        (WebCore::HTMLSelectElement::defaultEventHandler):
        * html/HTMLSelectElement.h:

        * WebCore.exp: Added _wkPopupMenu.
        * platform/mac/WebCoreSystemInterface.h: Added wkPopupMenu to get the NSMenu to pop up.
        * platform/mac/WebCoreSystemInterface.mm:

        * platform/win/TemporaryLinkStubs.cpp: Added stubs for RenderPopupMenuWin.
        (RenderPopupMenuWin::RenderPopupMenuWin):
        (RenderPopupMenuWin::~RenderPopupMenuWin):
        (RenderPopupMenuWin::clear):
        (RenderPopupMenuWin::populate):
        (RenderPopupMenuWin::showPopup):
        (RenderPopupMenuWin::addSeparator):
        (RenderPopupMenuWin::addGroupLabel):
        (RenderPopupMenuWin::addOption):
        * rendering/RenderPopupMenuWin.h: Added.

        * rendering/RenderPopupMenu.cpp: Added.
        (WebCore::RenderPopupMenu::RenderPopupMenu):
        (WebCore::RenderPopupMenu::~RenderPopupMenu):
        (WebCore::RenderPopupMenu::clear):
        (WebCore::RenderPopupMenu::populate): Walks the DOM tree, and adds separators, options, and group labels to the RenderPopupMenu.
        (WebCore::RenderPopupMenu::showPopup):
        (WebCore::RenderPopupMenu::addSeparator):
        (WebCore::RenderPopupMenu::addGroupLabel):
        (WebCore::RenderPopupMenu::addOption):
        * rendering/RenderPopupMenu.h: Added.
        (WebCore::RenderPopupMenu::renderName):
        (WebCore::RenderPopupMenu::getRenderMenuList):
        * rendering/RenderPopupMenuMac.h: Added.
        * rendering/RenderPopupMenuMac.mm: Added.
        (WebCore::RenderPopupMenuMac::RenderPopupMenuMac):
        (WebCore::RenderPopupMenuMac::~RenderPopupMenuMac):
        (WebCore::RenderPopupMenuMac::clear): Removes all items from the menu.
        (WebCore::RenderPopupMenuMac::populate): Disables menuChangedMessages before populating the menu.
        (WebCore::RenderPopupMenuMac::showPopup): Calculates the right position, and calls wkPopupMenu.
        (WebCore::RenderPopupMenuMac::addSeparator):
        (WebCore::RenderPopupMenuMac::addGroupLabel):
        (WebCore::RenderPopupMenuMac::addOption):

        * rendering/RenderMenuList.cpp: Added.
        (WebCore::RenderMenuList::RenderMenuList):
        (WebCore::RenderMenuList::addChild):
        (WebCore::RenderMenuList::removeChild):
        (WebCore::RenderMenuList::setStyle):
        (WebCore::RenderMenuList::updateFromElement): If the options have changed, iterate through the children to find the menu item with the widest text.
        Set the button text to the selected item's text.
        (WebCore::RenderMenuList::setText):
        (WebCore::RenderMenuList::paintObject):
        (WebCore::RenderMenuList::baselinePosition):
        (WebCore::RenderMenuList::calcMinMaxWidth):
        (WebCore::RenderMenuList::showPopup):
        (WebCore::RenderMenuList::layout):
        (WebCore::RenderMenuList::updateSelection):
        (WebCore::RenderMenuList::valueChanged):
        * rendering/RenderMenuList.h: Added.
        (WebCore::RenderMenuList::removeLeftoverAnonymousBoxes):
        (WebCore::RenderMenuList::allowsReusingAnonymousChild):
        (WebCore::RenderMenuList::canHaveChildren):
        (WebCore::RenderMenuList::renderName):
        (WebCore::RenderMenuList::setOptionsChanged):
        (WebCore::RenderMenuList::selectionChanged):
        (WebCore::RenderMenuList::setSelectionChanged):
        (WebCore::RenderMenuList::hasPopupMenu):

        * rendering/RenderTheme.cpp: Added cases for MenuListAppearance.
        (WebCore::RenderTheme::adjustStyle):
        (WebCore::RenderTheme::paint):
        (WebCore::RenderTheme::paintBorderOnly):
        (WebCore::RenderTheme::isControlStyled):
        (WebCore::RenderTheme::adjustMenuListStyle):
        (WebCore::RenderTheme::createPopupMenu): creates platform-specific RenderPopupMenu.
        * rendering/RenderTheme.h:
        (WebCore::RenderTheme::sizeOfArrowControl): Added.
        (WebCore::RenderTheme::paintMenuList): Added.
        * rendering/RenderThemeMac.h:
        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::adjustRepaintRect):
        (WebCore::RenderThemeMac::paintMenuList):
        (WebCore::RenderThemeMac::adjustMenuListStyle):
        (WebCore::RenderThemeMac::setPopupButtonCellState):
        (WebCore::RenderThemeMac::createPopupMenu):
        (WebCore::RenderThemeMac::sizeOfArrowControl):
        * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::createPopupMenu):
        * rendering/RenderThemeWin.h:

WebKit:

        Reviewed by Maciej and Hyatt.

        WebKit part of initial popup menu implementation.

        * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface):
        Initialize WKPopupMenu.

WebKitLibraries:

        Reviewed by Maciej and Hyatt.

        * WebKitSystemInterface.h: Updated.
        * libWebKitSystemInterface.a: Updated.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/cssstyleselector.cpp
WebCore/css/html4.css
WebCore/dom/Element.cpp
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/html/HTMLOptGroupElement.cpp
WebCore/html/HTMLOptGroupElement.h
WebCore/html/HTMLOptionElement.cpp
WebCore/html/HTMLOptionElement.h
WebCore/html/HTMLSelectElement.cpp
WebCore/html/HTMLSelectElement.h
WebCore/platform/mac/WebCoreSystemInterface.h
WebCore/platform/mac/WebCoreSystemInterface.mm
WebCore/platform/win/TemporaryLinkStubs.cpp
WebCore/rendering/RenderMenuList.cpp [new file with mode: 0644]
WebCore/rendering/RenderMenuList.h [new file with mode: 0644]
WebCore/rendering/RenderPopupMenu.cpp [new file with mode: 0644]
WebCore/rendering/RenderPopupMenu.h [new file with mode: 0644]
WebCore/rendering/RenderPopupMenuMac.h [new file with mode: 0644]
WebCore/rendering/RenderPopupMenuMac.mm [new file with mode: 0644]
WebCore/rendering/RenderPopupMenuWin.h [new file with mode: 0644]
WebCore/rendering/RenderTheme.cpp
WebCore/rendering/RenderTheme.h
WebCore/rendering/RenderThemeMac.h
WebCore/rendering/RenderThemeMac.mm
WebCore/rendering/RenderThemeWin.cpp
WebCore/rendering/RenderThemeWin.h
WebKit/ChangeLog
WebKit/WebCoreSupport/WebSystemInterface.m
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterface.a