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 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. | 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // the empty string the same as an element with no label attribute at all. | 114 // the empty string the same as an element with no label attribute at all. |
115 // Is that correct? If it is, then should the label function work the same w
ay? | 115 // Is that correct? If it is, then should the label function work the same w
ay? |
116 if (text.isEmpty()) | 116 if (text.isEmpty()) |
117 text = collectOptionInnerText(); | 117 text = collectOptionInnerText(); |
118 | 118 |
119 return text.stripWhiteSpace(isHTMLSpace<UChar>).simplifyWhiteSpace(isHTMLSpa
ce<UChar>); | 119 return text.stripWhiteSpace(isHTMLSpace<UChar>).simplifyWhiteSpace(isHTMLSpa
ce<UChar>); |
120 } | 120 } |
121 | 121 |
122 void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta
te) | 122 void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta
te) |
123 { | 123 { |
124 RefPtr<Node> protectFromMutationEvents(this); | 124 RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this); |
125 | 125 |
126 // Changing the text causes a recalc of a select's items, which will reset t
he selected | 126 // Changing the text causes a recalc of a select's items, which will reset t
he selected |
127 // index to the first item if the select is single selection with a menu lis
t. We attempt to | 127 // index to the first item if the select is single selection with a menu lis
t. We attempt to |
128 // preserve the selected item. | 128 // preserve the selected item. |
129 RefPtrWillBeRawPtr<HTMLSelectElement> select = ownerSelectElement(); | 129 RefPtrWillBeRawPtr<HTMLSelectElement> select = ownerSelectElement(); |
130 bool selectIsMenuList = select && select->usesMenuList(); | 130 bool selectIsMenuList = select && select->usesMenuList(); |
131 int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1; | 131 int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1; |
132 | 132 |
133 // Handle the common special case where there's exactly 1 child node, and it
's a text node. | 133 // Handle the common special case where there's exactly 1 child node, and it
's a text node. |
134 Node* child = firstChild(); | 134 Node* child = firstChild(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // Check for parent optgroup having display NONE | 372 // Check for parent optgroup having display NONE |
373 if (parent && isHTMLOptGroupElement(*parent)) { | 373 if (parent && isHTMLOptGroupElement(*parent)) { |
374 if (toHTMLOptGroupElement(*parent).isDisplayNone()) | 374 if (toHTMLOptGroupElement(*parent).isDisplayNone()) |
375 return true; | 375 return true; |
376 } | 376 } |
377 RenderStyle* style = nonRendererStyle(); | 377 RenderStyle* style = nonRendererStyle(); |
378 return style && style->display() == NONE; | 378 return style && style->display() == NONE; |
379 } | 379 } |
380 | 380 |
381 } // namespace WebCore | 381 } // namespace WebCore |
OLD | NEW |