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 21 matching lines...) Expand all Loading... |
74 { | 74 { |
75 return LayoutBlock::baselinePosition(baseline, firstLine, direction, pos
ition); | 75 return LayoutBlock::baselinePosition(baseline, firstLine, direction, pos
ition); |
76 } | 76 } |
77 int firstLineBoxBaseline() const override { return LayoutBlock::firstLineBox
Baseline(); } | 77 int firstLineBoxBaseline() const override { return LayoutBlock::firstLineBox
Baseline(); } |
78 int inlineBlockBaseline(LineDirectionMode direction) const override { return
LayoutBlock::inlineBlockBaseline(direction); } | 78 int inlineBlockBaseline(LineDirectionMode direction) const override { return
LayoutBlock::inlineBlockBaseline(direction); } |
79 | 79 |
80 void createInnerBlock(); | 80 void createInnerBlock(); |
81 void adjustInnerStyle(); | 81 void adjustInnerStyle(); |
82 void setText(const String&); | 82 void setText(const String&); |
83 void setTextFromOption(int optionIndex); | 83 void setTextFromOption(int optionIndex); |
84 void updateOptionsHeightWidth(); | 84 void updateOptionsHeightWidth() const; |
85 float computeTextHeight(const TextRun&, const ComputedStyle&) const; | 85 float computeTextHeight(const TextRun&, const ComputedStyle&) const; |
86 float computeTextWidth(const TextRun&, const ComputedStyle&) const; | 86 float computeTextWidth(const TextRun&, const ComputedStyle&) const; |
87 void updateText(); | |
88 void setIndexToSelectOnCancel(int listIndex); | 87 void setIndexToSelectOnCancel(int listIndex); |
89 | 88 |
90 void didUpdateActiveOption(int optionIndex); | 89 void didUpdateActiveOption(int optionIndex); |
91 | 90 |
92 LayoutText* m_buttonText; | 91 LayoutText* m_buttonText; |
93 LayoutBlock* m_innerBlock; | 92 LayoutBlock* m_innerBlock; |
94 | 93 |
95 bool m_optionsChanged : 1; | 94 mutable bool m_optionsChanged : 1; |
96 bool m_isEmpty : 1; | 95 bool m_isEmpty : 1; |
97 bool m_hasUpdatedActiveOption : 1; | 96 bool m_hasUpdatedActiveOption : 1; |
98 int m_optionsHeight; | 97 // m_optionsHeight and m_optionsWidth are calculated and cached on demand. |
99 int m_optionsWidth; | 98 // updateOptionsHeightWidth() should be called before reading them. |
| 99 mutable int m_optionsHeight; |
| 100 mutable int m_optionsWidth; |
100 | 101 |
101 int m_lastActiveIndex; | 102 int m_lastActiveIndex; |
102 | 103 |
103 RefPtr<ComputedStyle> m_optionStyle; | 104 RefPtr<ComputedStyle> m_optionStyle; |
104 }; | 105 }; |
105 | 106 |
106 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMenuList, isMenuList()); | 107 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMenuList, isMenuList()); |
107 | 108 |
108 } // namespace blink | 109 } // namespace blink |
109 | 110 |
110 #endif | 111 #endif |
OLD | NEW |