| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 inline HTMLOptGroupElement::HTMLOptGroupElement(Document& document) | 43 inline HTMLOptGroupElement::HTMLOptGroupElement(Document& document) |
| 44 : HTMLElement(optgroupTag, document) | 44 : HTMLElement(optgroupTag, document) |
| 45 { | 45 { |
| 46 setHasCustomStyleCallbacks(); | 46 setHasCustomStyleCallbacks(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 PassRefPtrWillBeRawPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(Document
& document) | 49 PassRefPtrWillBeRawPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(Document
& document) |
| 50 { | 50 { |
| 51 RefPtrWillBeRawPtr<HTMLOptGroupElement> optGroupElement = adoptRefWillBeNoop
(new HTMLOptGroupElement(document)); | 51 RefPtrWillBeRawPtr<HTMLOptGroupElement> optGroupElement = adoptRefWillBeNoop
(new HTMLOptGroupElement(document)); |
| 52 optGroupElement->ensureUserAgentShadowRoot(); | 52 optGroupElement->ensureClosedShadowRoot(); |
| 53 return optGroupElement.release(); | 53 return optGroupElement.release(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool HTMLOptGroupElement::isDisabledFormControl() const | 56 bool HTMLOptGroupElement::isDisabledFormControl() const |
| 57 { | 57 { |
| 58 return fastHasAttribute(disabledAttr); | 58 return fastHasAttribute(disabledAttr); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void HTMLOptGroupElement::childrenChanged(const ChildrenChange& change) | 61 void HTMLOptGroupElement::childrenChanged(const ChildrenChange& change) |
| 62 { | 62 { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 void HTMLOptGroupElement::accessKeyAction(bool) | 138 void HTMLOptGroupElement::accessKeyAction(bool) |
| 139 { | 139 { |
| 140 HTMLSelectElement* select = ownerSelectElement(); | 140 HTMLSelectElement* select = ownerSelectElement(); |
| 141 // send to the parent to bring focus to the list box | 141 // send to the parent to bring focus to the list box |
| 142 if (select && !select->focused()) | 142 if (select && !select->focused()) |
| 143 select->accessKeyAction(false); | 143 select->accessKeyAction(false); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 146 void HTMLOptGroupElement::didAddClosedShadowRoot(ShadowRoot& root) |
| 147 { | 147 { |
| 148 DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px", AtomicStri
ng::ConstructFromLiteral)); | 148 DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px", AtomicStri
ng::ConstructFromLiteral)); |
| 149 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co
nstructFromLiteral)); | 149 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co
nstructFromLiteral)); |
| 150 RefPtrWillBeRawPtr<HTMLDivElement> label = HTMLDivElement::create(document()
); | 150 RefPtrWillBeRawPtr<HTMLDivElement> label = HTMLDivElement::create(document()
); |
| 151 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF
romLiteral)); | 151 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF
romLiteral)); |
| 152 label->setAttribute(aria_labelAttr, AtomicString()); | 152 label->setAttribute(aria_labelAttr, AtomicString()); |
| 153 label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); | 153 label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); |
| 154 label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); | 154 label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); |
| 155 label->setIdAttribute(ShadowElementNames::optGroupLabel()); | 155 label->setIdAttribute(ShadowElementNames::optGroupLabel()); |
| 156 root.appendChild(label); | 156 root.appendChild(label); |
| 157 | 157 |
| 158 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); | 158 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); |
| 159 content->setAttribute(selectAttr, "option,optgroup,hr"); | 159 content->setAttribute(selectAttr, "option,optgroup,hr"); |
| 160 root.appendChild(content); | 160 root.appendChild(content); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void HTMLOptGroupElement::updateGroupLabel() | 163 void HTMLOptGroupElement::updateGroupLabel() |
| 164 { | 164 { |
| 165 const String& labelText = groupLabelText(); | 165 const String& labelText = groupLabelText(); |
| 166 HTMLDivElement& label = optGroupLabelElement(); | 166 HTMLDivElement& label = optGroupLabelElement(); |
| 167 label.setTextContent(labelText); | 167 label.setTextContent(labelText); |
| 168 label.setAttribute(aria_labelAttr, AtomicString(labelText)); | 168 label.setAttribute(aria_labelAttr, AtomicString(labelText)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const | 171 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const |
| 172 { | 172 { |
| 173 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement
Names::optGroupLabel())); | 173 return *toHTMLDivElement(closedShadowRoot()->getElementById(ShadowElementNam
es::optGroupLabel())); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace | 176 } // namespace |
| OLD | NEW |