| 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(docume
nt); |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 HTMLSelectElement* select = ownerSelectElement(); | 156 HTMLSelectElement* select = ownerSelectElement(); |
| 157 // send to the parent to bring focus to the list box | 157 // send to the parent to bring focus to the list box |
| 158 if (select && !select->focused()) | 158 if (select && !select->focused()) |
| 159 select->accessKeyAction(false); | 159 select->accessKeyAction(false); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 162 void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 163 { | 163 { |
| 164 DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px", AtomicStri
ng::ConstructFromLiteral)); | 164 DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px", AtomicStri
ng::ConstructFromLiteral)); |
| 165 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co
nstructFromLiteral)); | 165 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co
nstructFromLiteral)); |
| 166 RefPtrWillBeRawPtr<HTMLDivElement> label = HTMLDivElement::create(document()
); | 166 RawPtr<HTMLDivElement> label = HTMLDivElement::create(document()); |
| 167 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF
romLiteral)); | 167 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF
romLiteral)); |
| 168 label->setAttribute(aria_labelAttr, AtomicString()); | 168 label->setAttribute(aria_labelAttr, AtomicString()); |
| 169 label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); | 169 label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); |
| 170 label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); | 170 label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); |
| 171 label->setIdAttribute(ShadowElementNames::optGroupLabel()); | 171 label->setIdAttribute(ShadowElementNames::optGroupLabel()); |
| 172 root.appendChild(label); | 172 root.appendChild(label); |
| 173 | 173 |
| 174 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); | 174 RawPtr<HTMLContentElement> content = HTMLContentElement::create(document()); |
| 175 content->setAttribute(selectAttr, "option,hr"); | 175 content->setAttribute(selectAttr, "option,hr"); |
| 176 root.appendChild(content); | 176 root.appendChild(content); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void HTMLOptGroupElement::updateGroupLabel() | 179 void HTMLOptGroupElement::updateGroupLabel() |
| 180 { | 180 { |
| 181 const String& labelText = groupLabelText(); | 181 const String& labelText = groupLabelText(); |
| 182 HTMLDivElement& label = optGroupLabelElement(); | 182 HTMLDivElement& label = optGroupLabelElement(); |
| 183 label.setTextContent(labelText); | 183 label.setTextContent(labelText); |
| 184 label.setAttribute(aria_labelAttr, AtomicString(labelText)); | 184 label.setAttribute(aria_labelAttr, AtomicString(labelText)); |
| 185 } | 185 } |
| 186 | 186 |
| 187 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const | 187 HTMLDivElement& HTMLOptGroupElement::optGroupLabelElement() const |
| 188 { | 188 { |
| 189 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement
Names::optGroupLabel())); | 189 return *toHTMLDivElement(userAgentShadowRoot()->getElementById(ShadowElement
Names::optGroupLabel())); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |