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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.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) 2006, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 PassRefPtrWillBeRawPtr<SearchFieldDecorationElement> SearchFieldDecorationElemen t::create(Document& document) 160 PassRefPtrWillBeRawPtr<SearchFieldDecorationElement> SearchFieldDecorationElemen t::create(Document& document)
161 { 161 {
162 RefPtrWillBeRawPtr<SearchFieldDecorationElement> element = adoptRefWillBeNoo p(new SearchFieldDecorationElement(document)); 162 RefPtrWillBeRawPtr<SearchFieldDecorationElement> element = adoptRefWillBeNoo p(new SearchFieldDecorationElement(document));
163 element->setAttribute(idAttr, ShadowElementNames::searchDecoration()); 163 element->setAttribute(idAttr, ShadowElementNames::searchDecoration());
164 return element.release(); 164 return element.release();
165 } 165 }
166 166
167 const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const 167 const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const
168 { 168 {
169 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-resu lts-decoration", AtomicString::ConstructFromLiteral)); 169 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-resu lts-decoration"));
170 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration" , AtomicString::ConstructFromLiteral)); 170 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration" ));
171 Element* host = shadowHost(); 171 Element* host = shadowHost();
172 if (!host) 172 if (!host)
173 return resultsDecorationId; 173 return resultsDecorationId;
174 if (isHTMLInputElement(*host)) { 174 if (isHTMLInputElement(*host)) {
175 if (toHTMLInputElement(host)->maxResults() < 0) 175 if (toHTMLInputElement(host)->maxResults() < 0)
176 return decorationId; 176 return decorationId;
177 return resultsDecorationId; 177 return resultsDecorationId;
178 } 178 }
179 return resultsDecorationId; 179 return resultsDecorationId;
180 } 180 }
(...skipping 21 matching lines...) Expand all
202 202
203 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document& document) 203 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document& document)
204 : HTMLDivElement(document) 204 : HTMLDivElement(document)
205 , m_capturing(false) 205 , m_capturing(false)
206 { 206 {
207 } 207 }
208 208
209 PassRefPtrWillBeRawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonEl ement::create(Document& document) 209 PassRefPtrWillBeRawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonEl ement::create(Document& document)
210 { 210 {
211 RefPtrWillBeRawPtr<SearchFieldCancelButtonElement> element = adoptRefWillBeN oop(new SearchFieldCancelButtonElement(document)); 211 RefPtrWillBeRawPtr<SearchFieldCancelButtonElement> element = adoptRefWillBeN oop(new SearchFieldCancelButtonElement(document));
212 element->setShadowPseudoId(AtomicString("-webkit-search-cancel-button", Atom icString::ConstructFromLiteral)); 212 element->setShadowPseudoId(AtomicString("-webkit-search-cancel-button"));
213 element->setAttribute(idAttr, ShadowElementNames::clearButton()); 213 element->setAttribute(idAttr, ShadowElementNames::clearButton());
214 return element.release(); 214 return element.release();
215 } 215 }
216 216
217 void SearchFieldCancelButtonElement::detach(const AttachContext& context) 217 void SearchFieldCancelButtonElement::detach(const AttachContext& context)
218 { 218 {
219 if (m_capturing) { 219 if (m_capturing) {
220 if (LocalFrame* frame = document().frame()) 220 if (LocalFrame* frame = document().frame())
221 frame->eventHandler().setCapturingMouseEventsNode(nullptr); 221 frame->eventHandler().setCapturingMouseEventsNode(nullptr);
222 } 222 }
(...skipping 26 matching lines...) Expand all
249 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() 249 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents()
250 { 250 {
251 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); 251 const HTMLInputElement* input = toHTMLInputElement(shadowHost());
252 if (input && !input->isDisabledOrReadOnly()) 252 if (input && !input->isDisabledOrReadOnly())
253 return true; 253 return true;
254 254
255 return HTMLDivElement::willRespondToMouseClickEvents(); 255 return HTMLDivElement::willRespondToMouseClickEvents();
256 } 256 }
257 257
258 } // namespace blink 258 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698