diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderMenuList.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/RenderMenuList.h')
-rw-r--r-- | Source/WebCore/rendering/RenderMenuList.h | 117 |
1 files changed, 57 insertions, 60 deletions
diff --git a/Source/WebCore/rendering/RenderMenuList.h b/Source/WebCore/rendering/RenderMenuList.h index bba1501a7..ec46babaa 100644 --- a/Source/WebCore/rendering/RenderMenuList.h +++ b/Source/WebCore/rendering/RenderMenuList.h @@ -2,7 +2,7 @@ * This file is part of the select element renderer in WebCore. * * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2015 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,15 +21,14 @@ * */ -#ifndef RenderMenuList_h -#define RenderMenuList_h +#pragma once #include "LayoutRect.h" #include "PopupMenu.h" #include "PopupMenuClient.h" #include "RenderFlexibleBox.h" -#if PLATFORM(MAC) +#if PLATFORM(COCOA) #define POPUP_MENU_PULLS_DOWN 0 #else #define POPUP_MENU_PULLS_DOWN 1 @@ -43,7 +42,7 @@ class RenderText; class RenderMenuList final : public RenderFlexibleBox, private PopupMenuClient { public: - RenderMenuList(HTMLSelectElement&, PassRef<RenderStyle>); + RenderMenuList(HTMLSelectElement&, RenderStyle&&); virtual ~RenderMenuList(); HTMLSelectElement& selectElement() const; @@ -61,71 +60,70 @@ public: String text() const; private: - void element() const = delete; + void willBeDestroyed() override; - virtual bool isMenuList() const override { return true; } + void element() const = delete; - virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override; - virtual void removeChild(RenderObject&) override; - virtual bool createsAnonymousWrapper() const override { return true; } + bool isMenuList() const override { return true; } - virtual void updateFromElement() override; + void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override; + void removeChild(RenderObject&) override; + bool createsAnonymousWrapper() const override { return true; } - virtual LayoutRect controlClipRect(const LayoutPoint&) const override; - virtual bool hasControlClip() const override { return true; } - virtual bool canHaveGeneratedChildren() const override { return false; } - virtual bool canBeReplacedWithInlineRunIn() const override; + void updateFromElement() override; - virtual const char* renderName() const override { return "RenderMenuList"; } + LayoutRect controlClipRect(const LayoutPoint&) const override; + bool hasControlClip() const override { return true; } + bool canHaveGeneratedChildren() const override { return false; } - virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; - virtual void computePreferredLogicalWidths() override; + const char* renderName() const override { return "RenderMenuList"; } - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; + void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; + void computePreferredLogicalWidths() override; - virtual bool requiresForcedStyleRecalcPropagation() const override { return true; } + void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; // PopupMenuClient methods - virtual void valueChanged(unsigned listIndex, bool fireOnChange = true) override; - virtual void selectionChanged(unsigned, bool) override { } - virtual void selectionCleared() override { } - virtual String itemText(unsigned listIndex) const override; - virtual String itemLabel(unsigned listIndex) const override; - virtual String itemIcon(unsigned listIndex) const override; - virtual String itemToolTip(unsigned listIndex) const override; - virtual String itemAccessibilityText(unsigned listIndex) const override; - virtual bool itemIsEnabled(unsigned listIndex) const override; - virtual PopupMenuStyle itemStyle(unsigned listIndex) const override; - virtual PopupMenuStyle menuStyle() const override; - virtual int clientInsetLeft() const override; - virtual int clientInsetRight() const override; - virtual LayoutUnit clientPaddingLeft() const override; - virtual LayoutUnit clientPaddingRight() const override; - virtual int listSize() const override; - virtual int selectedIndex() const override; - virtual void popupDidHide() override; - virtual bool itemIsSeparator(unsigned listIndex) const override; - virtual bool itemIsLabel(unsigned listIndex) const override; - virtual bool itemIsSelected(unsigned listIndex) const override; - virtual bool shouldPopOver() const override { return !POPUP_MENU_PULLS_DOWN; } - virtual bool valueShouldChangeOnHotTrack() const override { return true; } - virtual void setTextFromItem(unsigned listIndex) override; - virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) override; - virtual bool multiple() const override; - virtual FontSelector* fontSelector() const override; - virtual HostWindow* hostWindow() const override; - virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize) override; - - virtual bool hasLineIfEmpty() const override { return true; } + void valueChanged(unsigned listIndex, bool fireOnChange = true) override; + void selectionChanged(unsigned, bool) override { } + void selectionCleared() override { } + String itemText(unsigned listIndex) const override; + String itemLabel(unsigned listIndex) const override; + String itemIcon(unsigned listIndex) const override; + String itemToolTip(unsigned listIndex) const override; + String itemAccessibilityText(unsigned listIndex) const override; + bool itemIsEnabled(unsigned listIndex) const override; + PopupMenuStyle itemStyle(unsigned listIndex) const override; + PopupMenuStyle menuStyle() const override; + int clientInsetLeft() const override; + int clientInsetRight() const override; + LayoutUnit clientPaddingLeft() const override; + LayoutUnit clientPaddingRight() const override; + int listSize() const override; + int selectedIndex() const override; + void popupDidHide() override; + bool itemIsSeparator(unsigned listIndex) const override; + bool itemIsLabel(unsigned listIndex) const override; + bool itemIsSelected(unsigned listIndex) const override; + bool shouldPopOver() const override { return !POPUP_MENU_PULLS_DOWN; } + bool valueShouldChangeOnHotTrack() const override { return true; } + void setTextFromItem(unsigned listIndex) override; + void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) override; + bool multiple() const override; + FontSelector* fontSelector() const override; + HostWindow* hostWindow() const override; + Ref<Scrollbar> createScrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override; + + bool hasLineIfEmpty() const override { return true; } // Flexbox defines baselines differently than regular blocks. // For backwards compatibility, menulists need to do the regular block behavior. - virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override + int baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override { return RenderBlock::baselinePosition(baseline, firstLine, direction, position); } - virtual int firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); } - virtual int inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } + std::optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); } + std::optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } void getItemBackgroundColor(unsigned listIndex, Color&, bool& itemHasCustomBackgroundColor) const; @@ -137,6 +135,8 @@ private: void didUpdateActiveOption(int optionIndex); + bool isFlexibleBoxImpl() const override { return true; } + RenderText* m_buttonText; RenderBlock* m_innerBlock; @@ -145,7 +145,7 @@ private: int m_lastActiveIndex; - RefPtr<RenderStyle> m_optionStyle; + std::unique_ptr<RenderStyle> m_optionStyle; #if !PLATFORM(IOS) RefPtr<PopupMenu> m_popup; @@ -153,9 +153,6 @@ private: #endif }; -template<> inline bool isRendererOfType<const RenderMenuList>(const RenderObject& renderer) { return renderer.isMenuList(); } -RENDER_OBJECT_TYPE_CASTS(RenderMenuList, isMenuList()) +} // namespace WebCore -} - -#endif +SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMenuList, isMenuList()) |