OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 { | 77 { |
78 ContainerNode* select = parentNode(); | 78 ContainerNode* select = parentNode(); |
79 while (select && !select->hasTagName(selectTag)) | 79 while (select && !select->hasTagName(selectTag)) |
80 select = select->parentNode(); | 80 select = select->parentNode(); |
81 if (select) | 81 if (select) |
82 toHTMLSelectElement(select)->setRecalcListItems(); | 82 toHTMLSelectElement(select)->setRecalcListItems(); |
83 } | 83 } |
84 | 84 |
85 void HTMLOptGroupElement::attach(const AttachContext& context) | 85 void HTMLOptGroupElement::attach(const AttachContext& context) |
86 { | 86 { |
87 updateNonRenderStyle(); | 87 if (context.resolvedStyle) { |
| 88 ASSERT(!m_style || m_style == context.resolvedStyle); |
| 89 m_style = context.resolvedStyle; |
| 90 } |
88 HTMLElement::attach(context); | 91 HTMLElement::attach(context); |
89 } | 92 } |
90 | 93 |
91 void HTMLOptGroupElement::detach(const AttachContext& context) | 94 void HTMLOptGroupElement::detach(const AttachContext& context) |
92 { | 95 { |
93 m_style.clear(); | 96 m_style.clear(); |
94 HTMLElement::detach(context); | 97 HTMLElement::detach(context); |
95 } | 98 } |
96 | 99 |
97 void HTMLOptGroupElement::updateNonRenderStyle() | 100 void HTMLOptGroupElement::updateNonRenderStyle() |
98 { | 101 { |
99 m_style = originalStyleForRenderer(); | 102 m_style = originalStyleForRenderer(); |
100 } | 103 } |
101 | 104 |
102 RenderStyle* HTMLOptGroupElement::nonRendererStyle() const | 105 RenderStyle* HTMLOptGroupElement::nonRendererStyle() const |
103 { | 106 { |
104 return m_style.get(); | 107 return m_style.get(); |
105 } | 108 } |
106 | 109 |
107 PassRefPtr<RenderStyle> HTMLOptGroupElement::customStyleForRenderer() | 110 PassRefPtr<RenderStyle> HTMLOptGroupElement::customStyleForRenderer() |
108 { | 111 { |
| 112 updateNonRenderStyle(); |
109 return m_style; | 113 return m_style; |
110 } | 114 } |
111 | 115 |
112 void HTMLOptGroupElement::willRecalcStyle(StyleRecalcChange change) | |
113 { | |
114 if (!needsAttach() && (needsStyleRecalc() || change >= Inherit)) | |
115 updateNonRenderStyle(); | |
116 } | |
117 | |
118 String HTMLOptGroupElement::groupLabelText() const | 116 String HTMLOptGroupElement::groupLabelText() const |
119 { | 117 { |
120 String itemText = getAttribute(labelAttr); | 118 String itemText = getAttribute(labelAttr); |
121 | 119 |
122 // In WinIE, leading and trailing whitespace is ignored in options and optgr
oups. We match this behavior. | 120 // In WinIE, leading and trailing whitespace is ignored in options and optgr
oups. We match this behavior. |
123 itemText = itemText.stripWhiteSpace(); | 121 itemText = itemText.stripWhiteSpace(); |
124 // We want to collapse our whitespace too. This will match other browsers. | 122 // We want to collapse our whitespace too. This will match other browsers. |
125 itemText = itemText.simplifyWhiteSpace(); | 123 itemText = itemText.simplifyWhiteSpace(); |
126 | 124 |
127 return itemText; | 125 return itemText; |
(...skipping 13 matching lines...) Expand all Loading... |
141 | 139 |
142 void HTMLOptGroupElement::accessKeyAction(bool) | 140 void HTMLOptGroupElement::accessKeyAction(bool) |
143 { | 141 { |
144 HTMLSelectElement* select = ownerSelectElement(); | 142 HTMLSelectElement* select = ownerSelectElement(); |
145 // send to the parent to bring focus to the list box | 143 // send to the parent to bring focus to the list box |
146 if (select && !select->focused()) | 144 if (select && !select->focused()) |
147 select->accessKeyAction(false); | 145 select->accessKeyAction(false); |
148 } | 146 } |
149 | 147 |
150 } // namespace | 148 } // namespace |
OLD | NEW |