OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the select element renderer in WebCore. | 2 * This file is part of the select element renderer in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "core/rendering/RenderFlexibleBox.h" | 27 #include "core/rendering/RenderFlexibleBox.h" |
28 #include "platform/PopupMenu.h" | 28 #include "platform/PopupMenu.h" |
29 #include "platform/PopupMenuClient.h" | 29 #include "platform/PopupMenuClient.h" |
30 #include "platform/geometry/LayoutRect.h" | 30 #include "platform/geometry/LayoutRect.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class HTMLSelectElement; | 34 class HTMLSelectElement; |
35 class RenderText; | 35 class RenderText; |
36 | 36 |
37 class RenderMenuList FINAL : public RenderFlexibleBox, private PopupMenuClient { | 37 class RenderMenuList final : public RenderFlexibleBox, private PopupMenuClient { |
38 | 38 |
39 public: | 39 public: |
40 RenderMenuList(Element*); | 40 RenderMenuList(Element*); |
41 virtual ~RenderMenuList(); | 41 virtual ~RenderMenuList(); |
42 virtual void destroy() OVERRIDE; | 42 virtual void destroy() override; |
43 virtual void trace(Visitor*) OVERRIDE; | 43 virtual void trace(Visitor*) override; |
44 | 44 |
45 bool popupIsVisible() const { return m_popupIsVisible; } | 45 bool popupIsVisible() const { return m_popupIsVisible; } |
46 void showPopup(); | 46 void showPopup(); |
47 void hidePopup(); | 47 void hidePopup(); |
48 | 48 |
49 void setOptionsChanged(bool changed) { m_optionsChanged = changed; } | 49 void setOptionsChanged(bool changed) { m_optionsChanged = changed; } |
50 | 50 |
51 void didSetSelectedIndex(int listIndex); | 51 void didSetSelectedIndex(int listIndex); |
52 | 52 |
53 String text() const; | 53 String text() const; |
54 | 54 |
55 virtual PopupMenuStyle itemStyle(unsigned listIndex) const OVERRIDE; | 55 virtual PopupMenuStyle itemStyle(unsigned listIndex) const override; |
56 | 56 |
57 private: | 57 private: |
58 HTMLSelectElement* selectElement() const; | 58 HTMLSelectElement* selectElement() const; |
59 | 59 |
60 virtual bool isMenuList() const OVERRIDE { return true; } | 60 virtual bool isMenuList() const override { return true; } |
61 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE; | 61 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const override; |
62 | 62 |
63 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; | 63 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
override; |
64 virtual void removeChild(RenderObject*) OVERRIDE; | 64 virtual void removeChild(RenderObject*) override; |
65 virtual bool createsAnonymousWrapper() const OVERRIDE { return true; } | 65 virtual bool createsAnonymousWrapper() const override { return true; } |
66 | 66 |
67 virtual void updateFromElement() OVERRIDE; | 67 virtual void updateFromElement() override; |
68 | 68 |
69 virtual LayoutRect controlClipRect(const LayoutPoint&) const OVERRIDE; | 69 virtual LayoutRect controlClipRect(const LayoutPoint&) const override; |
70 virtual bool hasControlClip() const OVERRIDE { return true; } | 70 virtual bool hasControlClip() const override { return true; } |
71 virtual bool canHaveGeneratedChildren() const OVERRIDE { return false; } | 71 virtual bool canHaveGeneratedChildren() const override { return false; } |
72 | 72 |
73 virtual const char* renderName() const OVERRIDE { return "RenderMenuList"; } | 73 virtual const char* renderName() const override { return "RenderMenuList"; } |
74 | 74 |
75 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const OVERRIDE; | 75 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const override; |
76 | 76 |
77 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 77 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
78 | 78 |
79 // PopupMenuClient methods | 79 // PopupMenuClient methods |
80 virtual void valueChanged(unsigned listIndex, bool fireOnChange = true) OVER
RIDE; | 80 virtual void valueChanged(unsigned listIndex, bool fireOnChange = true) over
ride; |
81 virtual void selectionChanged(unsigned, bool) OVERRIDE { } | 81 virtual void selectionChanged(unsigned, bool) override { } |
82 virtual void selectionCleared() OVERRIDE { } | 82 virtual void selectionCleared() override { } |
83 virtual String itemText(unsigned listIndex) const OVERRIDE; | 83 virtual String itemText(unsigned listIndex) const override; |
84 virtual String itemToolTip(unsigned listIndex) const OVERRIDE; | 84 virtual String itemToolTip(unsigned listIndex) const override; |
85 virtual String itemAccessibilityText(unsigned listIndex) const OVERRIDE; | 85 virtual String itemAccessibilityText(unsigned listIndex) const override; |
86 virtual bool itemIsEnabled(unsigned listIndex) const OVERRIDE; | 86 virtual bool itemIsEnabled(unsigned listIndex) const override; |
87 virtual PopupMenuStyle menuStyle() const OVERRIDE; | 87 virtual PopupMenuStyle menuStyle() const override; |
88 virtual LayoutUnit clientPaddingLeft() const OVERRIDE; | 88 virtual LayoutUnit clientPaddingLeft() const override; |
89 virtual LayoutUnit clientPaddingRight() const OVERRIDE; | 89 virtual LayoutUnit clientPaddingRight() const override; |
90 virtual int listSize() const OVERRIDE; | 90 virtual int listSize() const override; |
91 virtual int selectedIndex() const OVERRIDE; | 91 virtual int selectedIndex() const override; |
92 virtual void popupDidHide() OVERRIDE; | 92 virtual void popupDidHide() override; |
93 virtual bool itemIsSeparator(unsigned listIndex) const OVERRIDE; | 93 virtual bool itemIsSeparator(unsigned listIndex) const override; |
94 virtual bool itemIsLabel(unsigned listIndex) const OVERRIDE; | 94 virtual bool itemIsLabel(unsigned listIndex) const override; |
95 virtual bool itemIsSelected(unsigned listIndex) const OVERRIDE; | 95 virtual bool itemIsSelected(unsigned listIndex) const override; |
96 virtual void setTextFromItem(unsigned listIndex) OVERRIDE; | 96 virtual void setTextFromItem(unsigned listIndex) override; |
97 virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections,
bool shift, bool fireOnChangeNow = true) OVERRIDE; | 97 virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections,
bool shift, bool fireOnChangeNow = true) override; |
98 virtual bool multiple() const OVERRIDE; | 98 virtual bool multiple() const override; |
99 | 99 |
100 virtual bool hasLineIfEmpty() const OVERRIDE { return true; } | 100 virtual bool hasLineIfEmpty() const override { return true; } |
101 | 101 |
102 // Flexbox defines baselines differently than regular blocks. | 102 // Flexbox defines baselines differently than regular blocks. |
103 // For backwards compatibility, menulists need to do the regular block behav
ior. | 103 // For backwards compatibility, menulists need to do the regular block behav
ior. |
104 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire
ctionMode direction, LinePositionMode position) const OVERRIDE | 104 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire
ctionMode direction, LinePositionMode position) const override |
105 { | 105 { |
106 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos
ition); | 106 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos
ition); |
107 } | 107 } |
108 virtual int firstLineBoxBaseline() const OVERRIDE { return RenderBlock::firs
tLineBoxBaseline(); } | 108 virtual int firstLineBoxBaseline() const override { return RenderBlock::firs
tLineBoxBaseline(); } |
109 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE
{ return RenderBlock::inlineBlockBaseline(direction); } | 109 virtual int inlineBlockBaseline(LineDirectionMode direction) const override
{ return RenderBlock::inlineBlockBaseline(direction); } |
110 | 110 |
111 void getItemBackgroundColor(unsigned listIndex, Color&, bool& itemHasCustomB
ackgroundColor) const; | 111 void getItemBackgroundColor(unsigned listIndex, Color&, bool& itemHasCustomB
ackgroundColor) const; |
112 | 112 |
113 void createInnerBlock(); | 113 void createInnerBlock(); |
114 void adjustInnerStyle(); | 114 void adjustInnerStyle(); |
115 void setText(const String&); | 115 void setText(const String&); |
116 void setTextFromOption(int optionIndex); | 116 void setTextFromOption(int optionIndex); |
117 void updateOptionsWidth(); | 117 void updateOptionsWidth(); |
118 | 118 |
119 void didUpdateActiveOption(int optionIndex); | 119 void didUpdateActiveOption(int optionIndex); |
(...skipping 10 matching lines...) Expand all Loading... |
130 | 130 |
131 RefPtrWillBeMember<PopupMenu> m_popup; | 131 RefPtrWillBeMember<PopupMenu> m_popup; |
132 bool m_popupIsVisible; | 132 bool m_popupIsVisible; |
133 }; | 133 }; |
134 | 134 |
135 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMenuList, isMenuList()); | 135 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMenuList, isMenuList()); |
136 | 136 |
137 } | 137 } |
138 | 138 |
139 #endif | 139 #endif |
OLD | NEW |