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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 554933003: Make textInputFlags use static AtomicStrings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 2291
2292 return WebTextInputTypeNone; 2292 return WebTextInputTypeNone;
2293 } 2293 }
2294 2294
2295 int WebViewImpl::textInputFlags() 2295 int WebViewImpl::textInputFlags()
2296 { 2296 {
2297 Element* element = focusedElement(); 2297 Element* element = focusedElement();
2298 if (!element) 2298 if (!element)
2299 return WebTextInputFlagNone; 2299 return WebTextInputFlagNone;
2300 2300
2301 DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete", Atomi cString::ConstructFromLiteral));
2302 DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect", AtomicS tring::ConstructFromLiteral));
2303 DEFINE_STATIC_LOCAL(AtomicString, spellcheckString, ("spellcheck", AtomicStr ing::ConstructFromLiteral));
2301 int flags = 0; 2304 int flags = 0;
2302 2305
2303 const AtomicString& autocomplete = element->getAttribute("autocomplete"); 2306 const AtomicString& autocomplete = element->getAttribute(autocompleteString) ;
2304 if (autocomplete == "on") 2307 if (autocomplete == "on")
2305 flags |= WebTextInputFlagAutocompleteOn; 2308 flags |= WebTextInputFlagAutocompleteOn;
2306 else if (autocomplete == "off") 2309 else if (autocomplete == "off")
2307 flags |= WebTextInputFlagAutocompleteOff; 2310 flags |= WebTextInputFlagAutocompleteOff;
2308 2311
2309 const AtomicString& autocorrect = element->getAttribute("autocorrect"); 2312 const AtomicString& autocorrect = element->getAttribute(autocorrectString);
2310 if (autocorrect == "on") 2313 if (autocorrect == "on")
2311 flags |= WebTextInputFlagAutocorrectOn; 2314 flags |= WebTextInputFlagAutocorrectOn;
2312 else if (autocorrect == "off") 2315 else if (autocorrect == "off")
2313 flags |= WebTextInputFlagAutocorrectOff; 2316 flags |= WebTextInputFlagAutocorrectOff;
2314 2317
2315 const AtomicString& spellcheck = element->getAttribute("spellcheck"); 2318 const AtomicString& spellcheck = element->getAttribute(spellcheckString);
2316 if (spellcheck == "on") 2319 if (spellcheck == "on")
2317 flags |= WebTextInputFlagSpellcheckOn; 2320 flags |= WebTextInputFlagSpellcheckOn;
2318 else if (spellcheck == "off") 2321 else if (spellcheck == "off")
2319 flags |= WebTextInputFlagSpellcheckOff; 2322 flags |= WebTextInputFlagSpellcheckOff;
2320 2323
2321 return flags; 2324 return flags;
2322 } 2325 }
2323 2326
2324 WebString WebViewImpl::inputModeOfFocusedElement() 2327 WebString WebViewImpl::inputModeOfFocusedElement()
2325 { 2328 {
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after
4290 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4293 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4291 4294
4292 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4295 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4293 return false; 4296 return false;
4294 4297
4295 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4298 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4296 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4299 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4297 } 4300 }
4298 4301
4299 } // namespace blink 4302 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698