Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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"));
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 RefPtrWillBeRawPtr<HTMLSelectElement> select = HTMLSelectElement::create(doc ument());
83 select->setShadowPseudoId(keygenSelectPseudoId); 83 select->setShadowPseudoId(keygenSelectPseudoId);
84 for (const String& key : keys) { 84 for (const String& key : keys) {
(...skipping 23 matching lines...) Expand all
108 SecurityOrigin* topOrigin = document().frame()->tree().top()->securityContex t()->getSecurityOrigin(); 108 SecurityOrigin* topOrigin = document().frame()->tree().top()->securityContex t()->getSecurityOrigin();
109 String value = Platform::current()->signedPublicKeyAndChallengeString( 109 String value = Platform::current()->signedPublicKeyAndChallengeString(
110 shadowSelect()->selectedIndex(), fastGetAttribute(challengeAttr), docume nt().baseURL(), 110 shadowSelect()->selectedIndex(), fastGetAttribute(challengeAttr), docume nt().baseURL(),
111 KURL(KURL(), topOrigin->toString())); 111 KURL(KURL(), topOrigin->toString()));
112 if (!value.isNull()) 112 if (!value.isNull())
113 formData.append(name(), value); 113 formData.append(name(), value);
114 } 114 }
115 115
116 const AtomicString& HTMLKeygenElement::formControlType() const 116 const AtomicString& HTMLKeygenElement::formControlType() const
117 { 117 {
118 DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen", AtomicString::Con structFromLiteral)); 118 DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen"));
119 return keygen; 119 return keygen;
120 } 120 }
121 121
122 void HTMLKeygenElement::resetImpl() 122 void HTMLKeygenElement::resetImpl()
123 { 123 {
124 shadowSelect()->reset(); 124 shadowSelect()->reset();
125 } 125 }
126 126
127 HTMLSelectElement* HTMLKeygenElement::shadowSelect() const 127 HTMLSelectElement* HTMLKeygenElement::shadowSelect() const
128 { 128 {
129 ShadowRoot* root = userAgentShadowRoot(); 129 ShadowRoot* root = userAgentShadowRoot();
130 return root ? toHTMLSelectElement(root->firstChild()) : 0; 130 return root ? toHTMLSelectElement(root->firstChild()) : 0;
131 } 131 }
132 132
133 bool HTMLKeygenElement::isInteractiveContent() const 133 bool HTMLKeygenElement::isInteractiveContent() const
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698