1 | /* |
2 | * This file is part of the select element renderer in WebCore. |
3 | * |
4 | * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
5 | * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2015 Apple Inc. All rights reserved. |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Library General Public License |
18 | * along with this library; see the file COPYING.LIB. If not, write to |
19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | * Boston, MA 02110-1301, USA. |
21 | * |
22 | */ |
23 | |
24 | #pragma once |
25 | |
26 | #include "LayoutRect.h" |
27 | #include "PopupMenu.h" |
28 | #include "PopupMenuClient.h" |
29 | #include "RenderFlexibleBox.h" |
30 | |
31 | #if PLATFORM(COCOA) |
32 | #define POPUP_MENU_PULLS_DOWN 0 |
33 | #else |
34 | #define 1 |
35 | #endif |
36 | |
37 | namespace WebCore { |
38 | |
39 | class HTMLSelectElement; |
40 | class RenderText; |
41 | |
42 | class final : public RenderFlexibleBox, private PopupMenuClient { |
43 | WTF_MAKE_ISO_ALLOCATED(RenderMenuList); |
44 | public: |
45 | (HTMLSelectElement&, RenderStyle&&); |
46 | virtual (); |
47 | |
48 | HTMLSelectElement& () const; |
49 | |
50 | #if !PLATFORM(IOS_FAMILY) |
51 | bool () const { return m_popupIsVisible; } |
52 | #endif |
53 | void (); |
54 | void (); |
55 | |
56 | void (bool changed) { m_needsOptionsWidthUpdate = changed; } |
57 | |
58 | void (int listIndex); |
59 | |
60 | String () const; |
61 | |
62 | RenderBlock* () const { return m_innerBlock.get(); } |
63 | void (RenderBlock&); |
64 | |
65 | void (RenderObject& child, RenderObject* beforeChild); |
66 | |
67 | private: |
68 | void () override; |
69 | |
70 | void () const = delete; |
71 | |
72 | bool () const override { return true; } |
73 | |
74 | bool () const override { return true; } |
75 | |
76 | void () override; |
77 | |
78 | LayoutRect (const LayoutPoint&) const override; |
79 | bool () const override { return true; } |
80 | bool () const override { return false; } |
81 | |
82 | const char* () const override { return "RenderMenuList" ; } |
83 | |
84 | void (LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; |
85 | void () override; |
86 | |
87 | void (StyleDifference, const RenderStyle* oldStyle) override; |
88 | |
89 | // PopupMenuClient methods |
90 | void (unsigned listIndex, bool fireOnChange = true) override; |
91 | void (unsigned, bool) override { } |
92 | void () override { } |
93 | String (unsigned listIndex) const override; |
94 | String (unsigned listIndex) const override; |
95 | String (unsigned listIndex) const override; |
96 | String (unsigned listIndex) const override; |
97 | String (unsigned listIndex) const override; |
98 | bool (unsigned listIndex) const override; |
99 | PopupMenuStyle (unsigned listIndex) const override; |
100 | PopupMenuStyle () const override; |
101 | int () const override; |
102 | int () const override; |
103 | LayoutUnit () const override; |
104 | LayoutUnit () const override; |
105 | int () const override; |
106 | int () const override; |
107 | void () override; |
108 | bool (unsigned listIndex) const override; |
109 | bool (unsigned listIndex) const override; |
110 | bool (unsigned listIndex) const override; |
111 | bool () const override { return !POPUP_MENU_PULLS_DOWN; } |
112 | bool () const override { return true; } |
113 | void (unsigned listIndex) override; |
114 | void (int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) override; |
115 | bool () const override; |
116 | FontSelector* () const override; |
117 | HostWindow* () const override; |
118 | Ref<Scrollbar> (ScrollableArea&, ScrollbarOrientation, ScrollbarControlSize) override; |
119 | |
120 | bool () const override { return true; } |
121 | |
122 | // Flexbox defines baselines differently than regular blocks. |
123 | // For backwards compatibility, menulists need to do the regular block behavior. |
124 | int (FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const override |
125 | { |
126 | return RenderBlock::baselinePosition(baseline, firstLine, direction, position); |
127 | } |
128 | Optional<int> () const override { return RenderBlock::firstLineBaseline(); } |
129 | Optional<int> (LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); } |
130 | |
131 | void (unsigned listIndex, Color&, bool& itemHasCustomBackgroundColor) const; |
132 | |
133 | void (); |
134 | void (const String&); |
135 | void (int optionIndex); |
136 | void (); |
137 | |
138 | void (int optionIndex); |
139 | |
140 | bool () const override { return true; } |
141 | |
142 | WeakPtr<RenderText> ; |
143 | WeakPtr<RenderBlock> ; |
144 | |
145 | bool ; |
146 | int ; |
147 | |
148 | Optional<int> ; |
149 | |
150 | std::unique_ptr<RenderStyle> ; |
151 | |
152 | #if !PLATFORM(IOS_FAMILY) |
153 | RefPtr<PopupMenu> ; |
154 | bool ; |
155 | #endif |
156 | }; |
157 | |
158 | } // namespace WebCore |
159 | |
160 | SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMenuList, isMenuList()) |
161 | |