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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/SearchInputType.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 void SearchInputType::updateView() 153 void SearchInputType::updateView()
154 { 154 {
155 BaseTextInputType::updateView(); 155 BaseTextInputType::updateView();
156 updateCancelButtonVisibility(); 156 updateCancelButtonVisibility();
157 } 157 }
158 158
159 const AtomicString& SearchInputType::defaultAutocapitalize() const 159 const AtomicString& SearchInputType::defaultAutocapitalize() const
160 { 160 {
161 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences", AtomicStrin g::ConstructFromLiteral)); 161 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences"));
162 return sentences; 162 return sentences;
163 } 163 }
164 164
165 void SearchInputType::updateCancelButtonVisibility() 165 void SearchInputType::updateCancelButtonVisibility()
166 { 166 {
167 Element* button = element().userAgentShadowRoot()->getElementById(ShadowElem entNames::clearButton()); 167 Element* button = element().userAgentShadowRoot()->getElementById(ShadowElem entNames::clearButton());
168 if (!button) 168 if (!button)
169 return; 169 return;
170 if (element().value().isEmpty()) { 170 if (element().value().isEmpty()) {
171 button->setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValu e::UnitType::Number); 171 button->setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValu e::UnitType::Number);
172 button->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNone); 172 button->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNone);
173 } else { 173 } else {
174 button->removeInlineStyleProperty(CSSPropertyOpacity); 174 button->removeInlineStyleProperty(CSSPropertyOpacity);
175 button->removeInlineStyleProperty(CSSPropertyPointerEvents); 175 button->removeInlineStyleProperty(CSSPropertyPointerEvents);
176 } 176 }
177 } 177 }
178 178
179 bool SearchInputType::supportsInputModeAttribute() const 179 bool SearchInputType::supportsInputModeAttribute() const
180 { 180 {
181 return true; 181 return true;
182 } 182 }
183 183
184 } // namespace blink 184 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698