OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the select element layoutObject in WebCore. | 2 * This file is part of the select element layoutObject 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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 class HTMLSelectElement; | 33 class HTMLSelectElement; |
34 class LayoutText; | 34 class LayoutText; |
35 | 35 |
36 class CORE_EXPORT LayoutMenuList final : public LayoutFlexibleBox { | 36 class CORE_EXPORT LayoutMenuList final : public LayoutFlexibleBox { |
37 public: | 37 public: |
38 explicit LayoutMenuList(Element*); | 38 explicit LayoutMenuList(Element*); |
39 ~LayoutMenuList() override; | 39 ~LayoutMenuList() override; |
40 | 40 |
41 HTMLSelectElement* selectElement() const; | 41 HTMLSelectElement* selectElement() const; |
42 void setOptionsChanged(bool changed) { m_optionsChanged = changed; } | 42 void setOptionsChanged(bool); |
43 void didSetSelectedIndex(int optionIndex); | 43 void didSetSelectedIndex(int optionIndex); |
44 String text() const; | 44 String text() const; |
45 | 45 |
46 const char* name() const override { return "LayoutMenuList"; } | 46 const char* name() const override { return "LayoutMenuList"; } |
47 | 47 |
48 LayoutUnit clientPaddingLeft() const; | 48 LayoutUnit clientPaddingLeft() const; |
49 LayoutUnit clientPaddingRight() const; | 49 LayoutUnit clientPaddingRight() const; |
50 | 50 |
51 private: | 51 private: |
52 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectMenuList || LayoutFlexibleBox::isOfType(type); } | 52 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectMenuList || LayoutFlexibleBox::isOfType(type); } |
(...skipping 20 matching lines...) Expand all Loading... |
73 { | 73 { |
74 return LayoutBlock::baselinePosition(baseline, firstLine, direction, pos
ition); | 74 return LayoutBlock::baselinePosition(baseline, firstLine, direction, pos
ition); |
75 } | 75 } |
76 int firstLineBoxBaseline() const override { return LayoutBlock::firstLineBox
Baseline(); } | 76 int firstLineBoxBaseline() const override { return LayoutBlock::firstLineBox
Baseline(); } |
77 int inlineBlockBaseline(LineDirectionMode direction) const override { return
LayoutBlock::inlineBlockBaseline(direction); } | 77 int inlineBlockBaseline(LineDirectionMode direction) const override { return
LayoutBlock::inlineBlockBaseline(direction); } |
78 | 78 |
79 void createInnerBlock(); | 79 void createInnerBlock(); |
80 void adjustInnerStyle(); | 80 void adjustInnerStyle(); |
81 void setText(const String&); | 81 void setText(const String&); |
82 void setTextFromOption(int optionIndex); | 82 void setTextFromOption(int optionIndex); |
83 void updateOptionsWidth(); | 83 void updateOptionsWidth() const; |
84 float computeTextWidth(const String&) const; | 84 float computeTextWidth(const String&) const; |
85 void updateText(); | |
86 void setIndexToSelectOnCancel(int listIndex); | 85 void setIndexToSelectOnCancel(int listIndex); |
87 | 86 |
88 void didUpdateActiveOption(int optionIndex); | 87 void didUpdateActiveOption(int optionIndex); |
89 | 88 |
90 LayoutText* m_buttonText; | 89 LayoutText* m_buttonText; |
91 LayoutBlock* m_innerBlock; | 90 LayoutBlock* m_innerBlock; |
92 | 91 |
93 bool m_optionsChanged : 1; | 92 mutable bool m_optionsChanged : 1; |
94 bool m_isEmpty : 1; | 93 bool m_isEmpty : 1; |
95 bool m_hasUpdatedActiveOption : 1; | 94 bool m_hasUpdatedActiveOption : 1; |
96 int m_optionsWidth; | 95 // m_optionsWidth is calculated and cached on demand. |
| 96 // updateOptionsWidth() should be called before reading them. |
| 97 mutable int m_optionsWidth; |
97 | 98 |
98 int m_lastActiveIndex; | 99 int m_lastActiveIndex; |
99 | 100 |
100 RefPtr<ComputedStyle> m_optionStyle; | 101 RefPtr<ComputedStyle> m_optionStyle; |
101 }; | 102 }; |
102 | 103 |
103 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMenuList, isMenuList()); | 104 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMenuList, isMenuList()); |
104 | 105 |
105 } // namespace blink | 106 } // namespace blink |
106 | 107 |
107 #endif | 108 #endif |
OLD | NEW |