| 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, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 using namespace HTMLNames; | 47 using namespace HTMLNames; |
| 48 | 48 |
| 49 HTMLKeygenElement::HTMLKeygenElement(Document& document, HTMLFormElement* form) | 49 HTMLKeygenElement::HTMLKeygenElement(Document& document, HTMLFormElement* form) |
| 50 : HTMLFormControlElementWithState(keygenTag, document, form) | 50 : HTMLFormControlElementWithState(keygenTag, document, form) |
| 51 { | 51 { |
| 52 Deprecation::countDeprecation(document, UseCounter::HTMLKeygenElement); | 52 Deprecation::countDeprecation(document, UseCounter::HTMLKeygenElement); |
| 53 if (document.frame()) | 53 if (document.frame()) |
| 54 document.frame()->loader().client()->didUseKeygen(); | 54 document.frame()->loader().client()->didUseKeygen(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 PassRefPtrWillBeRawPtr<HTMLKeygenElement> HTMLKeygenElement::create(Document& do
cument, HTMLFormElement* form) | 57 RawPtr<HTMLKeygenElement> HTMLKeygenElement::create(Document& document, HTMLForm
Element* form) |
| 58 { | 58 { |
| 59 RefPtrWillBeRawPtr<HTMLKeygenElement> keygen = adoptRefWillBeNoop(new HTMLKe
ygenElement(document, form)); | 59 RawPtr<HTMLKeygenElement> keygen = new HTMLKeygenElement(document, form); |
| 60 keygen->ensureUserAgentShadowRoot(); | 60 keygen->ensureUserAgentShadowRoot(); |
| 61 return keygen.release(); | 61 return keygen.release(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 LayoutObject* HTMLKeygenElement::createLayoutObject(const ComputedStyle& style) | 64 LayoutObject* HTMLKeygenElement::createLayoutObject(const ComputedStyle& style) |
| 65 { | 65 { |
| 66 // TODO(mstensho): While it's harmful and meaningless to allow most display
types on replaced | 66 // TODO(mstensho): While it's harmful and meaningless to allow most display
types on replaced |
| 67 // content (e.g. table, table-row or flex), it would be useful to honor at l
east some of | 67 // content (e.g. table, table-row or flex), it would be useful to honor at l
east some of |
| 68 // them. Table-cell (and maybe table-caption too), for instance. See crbug.c
om/335040 | 68 // them. Table-cell (and maybe table-caption too), for instance. See crbug.c
om/335040 |
| 69 return new LayoutBlockFlow(this); | 69 return new LayoutBlockFlow(this); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void HTMLKeygenElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 72 void HTMLKeygenElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 73 { | 73 { |
| 74 DEFINE_STATIC_LOCAL(AtomicString, keygenSelectPseudoId, ("-webkit-keygen-sel
ect", AtomicString::ConstructFromLiteral)); | 74 DEFINE_STATIC_LOCAL(AtomicString, keygenSelectPseudoId, ("-webkit-keygen-sel
ect", AtomicString::ConstructFromLiteral)); |
| 75 | 75 |
| 76 Vector<String> keys; | 76 Vector<String> keys; |
| 77 keys.reserveCapacity(2); | 77 keys.reserveCapacity(2); |
| 78 keys.append(locale().queryString(WebLocalizedString::KeygenMenuHighGradeKeyS
ize)); | 78 keys.append(locale().queryString(WebLocalizedString::KeygenMenuHighGradeKeyS
ize)); |
| 79 keys.append(locale().queryString(WebLocalizedString::KeygenMenuMediumGradeKe
ySize)); | 79 keys.append(locale().queryString(WebLocalizedString::KeygenMenuMediumGradeKe
ySize)); |
| 80 | 80 |
| 81 // Create a select element with one option element for each key size. | 81 // Create a select element with one option element for each key size. |
| 82 RefPtrWillBeRawPtr<HTMLSelectElement> select = HTMLSelectElement::create(doc
ument()); | 82 RawPtr<HTMLSelectElement> select = HTMLSelectElement::create(document()); |
| 83 select->setShadowPseudoId(keygenSelectPseudoId); | 83 select->setShadowPseudoId(keygenSelectPseudoId); |
| 84 for (const String& key : keys) { | 84 for (const String& key : keys) { |
| 85 RefPtrWillBeRawPtr<HTMLOptionElement> option = HTMLOptionElement::create
(document()); | 85 RawPtr<HTMLOptionElement> option = HTMLOptionElement::create(document())
; |
| 86 option->appendChild(Text::create(document(), key)); | 86 option->appendChild(Text::create(document(), key)); |
| 87 select->appendChild(option); | 87 select->appendChild(option); |
| 88 } | 88 } |
| 89 | 89 |
| 90 root.appendChild(select); | 90 root.appendChild(select); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& oldValue, const AtomicString& value) | 93 void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& oldValue, const AtomicString& value) |
| 94 { | 94 { |
| 95 // Reflect disabled attribute on the shadow select element | 95 // Reflect disabled attribute on the shadow select element |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 { | 134 { |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool HTMLKeygenElement::supportsAutofocus() const | 138 bool HTMLKeygenElement::supportsAutofocus() const |
| 139 { | 139 { |
| 140 return true; | 140 return true; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |