| 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 27 matching lines...) Expand all Loading... |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 using namespace HTMLNames; | 40 using namespace HTMLNames; |
| 41 | 41 |
| 42 inline HTMLOptGroupElement::HTMLOptGroupElement(Document& document) | 42 inline HTMLOptGroupElement::HTMLOptGroupElement(Document& document) |
| 43 : HTMLElement(optgroupTag, document) | 43 : HTMLElement(optgroupTag, document) |
| 44 { | 44 { |
| 45 setHasCustomStyleCallbacks(); | 45 setHasCustomStyleCallbacks(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 PassRefPtrWillBeRawPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(Document
& document) | 48 RawPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(Document& document) |
| 49 { | 49 { |
| 50 RefPtrWillBeRawPtr<HTMLOptGroupElement> optGroupElement = adoptRefWillBeNoop
(new HTMLOptGroupElement(document)); | 50 RawPtr<HTMLOptGroupElement> optGroupElement = (new HTMLOptGroupElement(docum
ent)); |
| 51 optGroupElement->ensureUserAgentShadowRoot(); | 51 optGroupElement->ensureUserAgentShadowRoot(); |
| 52 return optGroupElement.release(); | 52 return optGroupElement.release(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool HTMLOptGroupElement::isDisabledFormControl() const | 55 bool HTMLOptGroupElement::isDisabledFormControl() const |
| 56 { | 56 { |
| 57 return fastHasAttribute(disabledAttr); | 57 return fastHasAttribute(disabledAttr); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void HTMLOptGroupElement::childrenChanged(const ChildrenChange& change) | 60 void HTMLOptGroupElement::childrenChanged(const ChildrenChange& change) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 void HTMLOptGroupElement::detach(const AttachContext& context) | 95 void HTMLOptGroupElement::detach(const AttachContext& context) |
| 96 { | 96 { |
| 97 m_style.clear(); | 97 m_style.clear(); |
| 98 HTMLElement::detach(context); | 98 HTMLElement::detach(context); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool HTMLOptGroupElement::supportsFocus() const | 101 bool HTMLOptGroupElement::supportsFocus() const |
| 102 { | 102 { |
| 103 RefPtrWillBeRawPtr<HTMLSelectElement> select = ownerSelectElement(); | 103 RawPtr<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::updateNonComputedStyle() | 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()) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 HTMLSelectElement* select = ownerSelectElement(); | 149 HTMLSelectElement* select = ownerSelectElement(); |
| 150 // send to the parent to bring focus to the list box | 150 // send to the parent to bring focus to the list box |
| 151 if (select && !select->focused()) | 151 if (select && !select->focused()) |
| 152 select->accessKeyAction(false); | 152 select->accessKeyAction(false); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 155 void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 156 { | 156 { |
| 157 DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px", AtomicStri
ng::ConstructFromLiteral)); | 157 DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px", AtomicStri
ng::ConstructFromLiteral)); |
| 158 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co
nstructFromLiteral)); | 158 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co
nstructFromLiteral)); |
| 159 RefPtrWillBeRawPtr<HTMLDivElement> label = HTMLDivElement::create(document()
); | 159 RawPtr<HTMLDivElement> label = HTMLDivElement::create(document()); |
| 160 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF
romLiteral)); | 160 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF
romLiteral)); |
| 161 label->setAttribute(aria_labelAttr, AtomicString()); | 161 label->setAttribute(aria_labelAttr, AtomicString()); |
| 162 label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); | 162 label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); |
| 163 label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); | 163 label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); |
| 164 label->setIdAttribute(ShadowElementNames::optGroupLabel()); | 164 label->setIdAttribute(ShadowElementNames::optGroupLabel()); |
| 165 root.appendChild(label); | 165 root.appendChild(label); |
| 166 | 166 |
| 167 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); | 167 RawPtr<HTMLContentElement> content = HTMLContentElement::create(document()); |
| 168 content->setAttribute(selectAttr, "option,hr"); | 168 content->setAttribute(selectAttr, "option,hr"); |
| 169 root.appendChild(content); | 169 root.appendChild(content); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void HTMLOptGroupElement::updateGroupLabel() | 172 void HTMLOptGroupElement::updateGroupLabel() |
| 173 { | 173 { |
| 174 const String& labelText = groupLabelText(); | 174 const String& labelText = groupLabelText(); |
| 175 HTMLDivElement& label = optGroupLabelElement(); | 175 HTMLDivElement& label = optGroupLabelElement(); |
| 176 label.setTextContent(labelText); | 176 label.setTextContent(labelText); |
| 177 label.setAttribute(aria_labelAttr, AtomicString(labelText)); | 177 label.setAttribute(aria_labelAttr, AtomicString(labelText)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const | 180 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const |
| 181 { | 181 { |
| 182 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement
Names::optGroupLabel())); | 182 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement
Names::optGroupLabel())); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace blink | 185 } // namespace blink |
| OLD | NEW |