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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLOptGroupElement.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, 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void HTMLOptGroupElement::accessKeyAction(bool) 154 void HTMLOptGroupElement::accessKeyAction(bool)
155 { 155 {
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"));
165 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em", AtomicString::Co nstructFromLiteral)); 165 DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em"));
166 RefPtrWillBeRawPtr<HTMLDivElement> label = HTMLDivElement::create(document() ); 166 RefPtrWillBeRawPtr<HTMLDivElement> label = HTMLDivElement::create(document() );
167 label->setAttribute(roleAttr, AtomicString("group", AtomicString::ConstructF romLiteral)); 167 label->setAttribute(roleAttr, AtomicString("group"));
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 RefPtrWillBeRawPtr<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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698