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 AttachContext optGroupContext(context); |
88 HTMLElement::attach(context); | 88 if (context.resolvedStyle) { |
89 ASSERT(!m_style || m_style == context.resolvedStyle); | |
90 m_style = context.resolvedStyle; | |
91 } else { | |
92 updateNonRenderStyle(); | |
93 optGroupContext.resolvedStyle = m_style.get(); | |
esprehn
2014/02/19 00:04:16
Why do you need this branch? Shouldn't the createR
rune
2014/02/19 09:47:26
Done.
| |
94 } | |
95 HTMLElement::attach(optGroupContext); | |
89 } | 96 } |
90 | 97 |
91 void HTMLOptGroupElement::detach(const AttachContext& context) | 98 void HTMLOptGroupElement::detach(const AttachContext& context) |
92 { | 99 { |
93 m_style.clear(); | 100 m_style.clear(); |
94 HTMLElement::detach(context); | 101 HTMLElement::detach(context); |
95 } | 102 } |
96 | 103 |
97 void HTMLOptGroupElement::updateNonRenderStyle() | 104 void HTMLOptGroupElement::updateNonRenderStyle() |
98 { | 105 { |
99 m_style = originalStyleForRenderer(); | 106 m_style = originalStyleForRenderer(); |
100 } | 107 } |
101 | 108 |
102 RenderStyle* HTMLOptGroupElement::nonRendererStyle() const | 109 RenderStyle* HTMLOptGroupElement::nonRendererStyle() const |
103 { | 110 { |
104 return m_style.get(); | 111 return m_style.get(); |
105 } | 112 } |
106 | 113 |
107 PassRefPtr<RenderStyle> HTMLOptGroupElement::customStyleForRenderer() | 114 PassRefPtr<RenderStyle> HTMLOptGroupElement::customStyleForRenderer() |
108 { | 115 { |
116 updateNonRenderStyle(); | |
109 return m_style; | 117 return m_style; |
110 } | 118 } |
111 | 119 |
112 void HTMLOptGroupElement::willRecalcStyle(StyleRecalcChange change) | |
113 { | |
114 if (!needsAttach() && (needsStyleRecalc() || change >= Inherit)) | |
115 updateNonRenderStyle(); | |
116 } | |
117 | |
118 String HTMLOptGroupElement::groupLabelText() const | 120 String HTMLOptGroupElement::groupLabelText() const |
119 { | 121 { |
120 String itemText = getAttribute(labelAttr); | 122 String itemText = getAttribute(labelAttr); |
121 | 123 |
122 // In WinIE, leading and trailing whitespace is ignored in options and optgr oups. We match this behavior. | 124 // In WinIE, leading and trailing whitespace is ignored in options and optgr oups. We match this behavior. |
123 itemText = itemText.stripWhiteSpace(); | 125 itemText = itemText.stripWhiteSpace(); |
124 // We want to collapse our whitespace too. This will match other browsers. | 126 // We want to collapse our whitespace too. This will match other browsers. |
125 itemText = itemText.simplifyWhiteSpace(); | 127 itemText = itemText.simplifyWhiteSpace(); |
126 | 128 |
127 return itemText; | 129 return itemText; |
(...skipping 13 matching lines...) Expand all Loading... | |
141 | 143 |
142 void HTMLOptGroupElement::accessKeyAction(bool) | 144 void HTMLOptGroupElement::accessKeyAction(bool) |
143 { | 145 { |
144 HTMLSelectElement* select = ownerSelectElement(); | 146 HTMLSelectElement* select = ownerSelectElement(); |
145 // send to the parent to bring focus to the list box | 147 // send to the parent to bring focus to the list box |
146 if (select && !select->focused()) | 148 if (select && !select->focused()) |
147 select->accessKeyAction(false); | 149 select->accessKeyAction(false); |
148 } | 150 } |
149 | 151 |
150 } // namespace | 152 } // namespace |
OLD | NEW |