| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/html/HTMLOptGroupElement.h" | 26 #include "core/html/HTMLOptGroupElement.h" |
| 27 | 27 |
| 28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
| 29 #include "core/dom/NodeLayoutStyle.h" | 29 #include "core/dom/NodeComputedStyle.h" |
| 30 #include "core/dom/Text.h" | 30 #include "core/dom/Text.h" |
| 31 #include "core/editing/htmlediting.h" | 31 #include "core/editing/htmlediting.h" |
| 32 #include "core/html/HTMLContentElement.h" | 32 #include "core/html/HTMLContentElement.h" |
| 33 #include "core/html/HTMLDivElement.h" | 33 #include "core/html/HTMLDivElement.h" |
| 34 #include "core/html/HTMLSelectElement.h" | 34 #include "core/html/HTMLSelectElement.h" |
| 35 #include "core/html/shadow/ShadowElementNames.h" | 35 #include "core/html/shadow/ShadowElementNames.h" |
| 36 #include "wtf/StdLibExtras.h" | 36 #include "wtf/StdLibExtras.h" |
| 37 #include "wtf/unicode/CharacterNames.h" | 37 #include "wtf/unicode/CharacterNames.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool HTMLOptGroupElement::supportsFocus() const | 101 bool HTMLOptGroupElement::supportsFocus() const |
| 102 { | 102 { |
| 103 RefPtrWillBeRawPtr<HTMLSelectElement> select = ownerSelectElement(); | 103 RefPtrWillBeRawPtr<HTMLSelectElement> select = ownerSelectElement(); |
| 104 if (select && select->usesMenuList()) | 104 if (select && select->usesMenuList()) |
| 105 return false; | 105 return false; |
| 106 return HTMLElement::supportsFocus(); | 106 return HTMLElement::supportsFocus(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void HTMLOptGroupElement::updateNonLayoutStyle() | 109 void HTMLOptGroupElement::updateNonComputedStyle() |
| 110 { | 110 { |
| 111 m_style = originalStyleForLayoutObject(); | 111 m_style = originalStyleForLayoutObject(); |
| 112 if (layoutObject()) { | 112 if (layoutObject()) { |
| 113 if (HTMLSelectElement* select = ownerSelectElement()) | 113 if (HTMLSelectElement* select = ownerSelectElement()) |
| 114 select->updateListOnRenderer(); | 114 select->updateListOnRenderer(); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 LayoutStyle* HTMLOptGroupElement::nonRendererStyle() const | 118 ComputedStyle* HTMLOptGroupElement::nonLayoutObjectComputedStyle() const |
| 119 { | 119 { |
| 120 return m_style.get(); | 120 return m_style.get(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 PassRefPtr<LayoutStyle> HTMLOptGroupElement::customStyleForLayoutObject() | 123 PassRefPtr<ComputedStyle> HTMLOptGroupElement::customStyleForLayoutObject() |
| 124 { | 124 { |
| 125 updateNonLayoutStyle(); | 125 updateNonComputedStyle(); |
| 126 return m_style; | 126 return m_style; |
| 127 } | 127 } |
| 128 | 128 |
| 129 String HTMLOptGroupElement::groupLabelText() const | 129 String HTMLOptGroupElement::groupLabelText() const |
| 130 { | 130 { |
| 131 String itemText = getAttribute(labelAttr); | 131 String itemText = getAttribute(labelAttr); |
| 132 | 132 |
| 133 // In WinIE, leading and trailing whitespace is ignored in options and optgr
oups. We match this behavior. | 133 // In WinIE, leading and trailing whitespace is ignored in options and optgr
oups. We match this behavior. |
| 134 itemText = itemText.stripWhiteSpace(); | 134 itemText = itemText.stripWhiteSpace(); |
| 135 // We want to collapse our whitespace too. This will match other browsers. | 135 // We want to collapse our whitespace too. This will match other browsers. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 label.setTextContent(labelText); | 175 label.setTextContent(labelText); |
| 176 label.setAttribute(aria_labelAttr, AtomicString(labelText)); | 176 label.setAttribute(aria_labelAttr, AtomicString(labelText)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const | 179 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const |
| 180 { | 180 { |
| 181 return *toHTMLDivElement(closedShadowRoot()->getElementById(ShadowElementNam
es::optGroupLabel())); | 181 return *toHTMLDivElement(closedShadowRoot()->getElementById(ShadowElementNam
es::optGroupLabel())); |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace | 184 } // namespace |
| OLD | NEW |