OLD | NEW |
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 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 | 2504 |
2505 return WebTextInputTypeNone; | 2505 return WebTextInputTypeNone; |
2506 } | 2506 } |
2507 | 2507 |
2508 int WebViewImpl::textInputFlags() | 2508 int WebViewImpl::textInputFlags() |
2509 { | 2509 { |
2510 Element* element = focusedElement(); | 2510 Element* element = focusedElement(); |
2511 if (!element) | 2511 if (!element) |
2512 return WebTextInputFlagNone; | 2512 return WebTextInputFlagNone; |
2513 | 2513 |
2514 DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete", Atomi
cString::ConstructFromLiteral)); | 2514 DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete")); |
2515 DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect", AtomicS
tring::ConstructFromLiteral)); | 2515 DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect")); |
2516 int flags = 0; | 2516 int flags = 0; |
2517 | 2517 |
2518 const AtomicString& autocomplete = element->getAttribute(autocompleteString)
; | 2518 const AtomicString& autocomplete = element->getAttribute(autocompleteString)
; |
2519 if (autocomplete == "on") | 2519 if (autocomplete == "on") |
2520 flags |= WebTextInputFlagAutocompleteOn; | 2520 flags |= WebTextInputFlagAutocompleteOn; |
2521 else if (autocomplete == "off") | 2521 else if (autocomplete == "off") |
2522 flags |= WebTextInputFlagAutocompleteOff; | 2522 flags |= WebTextInputFlagAutocompleteOff; |
2523 | 2523 |
2524 const AtomicString& autocorrect = element->getAttribute(autocorrectString); | 2524 const AtomicString& autocorrect = element->getAttribute(autocorrectString); |
2525 if (autocorrect == "on") | 2525 if (autocorrect == "on") |
2526 flags |= WebTextInputFlagAutocorrectOn; | 2526 flags |= WebTextInputFlagAutocorrectOn; |
2527 else if (autocorrect == "off") | 2527 else if (autocorrect == "off") |
2528 flags |= WebTextInputFlagAutocorrectOff; | 2528 flags |= WebTextInputFlagAutocorrectOff; |
2529 | 2529 |
2530 SpellcheckAttributeState spellcheck = element->spellcheckAttributeState(); | 2530 SpellcheckAttributeState spellcheck = element->spellcheckAttributeState(); |
2531 if (spellcheck == SpellcheckAttributeTrue) | 2531 if (spellcheck == SpellcheckAttributeTrue) |
2532 flags |= WebTextInputFlagSpellcheckOn; | 2532 flags |= WebTextInputFlagSpellcheckOn; |
2533 else if (spellcheck == SpellcheckAttributeFalse) | 2533 else if (spellcheck == SpellcheckAttributeFalse) |
2534 flags |= WebTextInputFlagSpellcheckOff; | 2534 flags |= WebTextInputFlagSpellcheckOff; |
2535 | 2535 |
2536 if (isHTMLTextFormControlElement(element)) { | 2536 if (isHTMLTextFormControlElement(element)) { |
2537 HTMLTextFormControlElement* formElement = static_cast<HTMLTextFormContro
lElement*>(element); | 2537 HTMLTextFormControlElement* formElement = static_cast<HTMLTextFormContro
lElement*>(element); |
2538 if (formElement->supportsAutocapitalize()) { | 2538 if (formElement->supportsAutocapitalize()) { |
2539 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none", AtomicString:
:ConstructFromLiteral)); | 2539 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none")); |
2540 DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters", A
tomicString::ConstructFromLiteral)); | 2540 DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters")); |
2541 DEFINE_STATIC_LOCAL(const AtomicString, words, ("words", AtomicStrin
g::ConstructFromLiteral)); | 2541 DEFINE_STATIC_LOCAL(const AtomicString, words, ("words")); |
2542 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences", Ato
micString::ConstructFromLiteral)); | 2542 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences")); |
2543 | 2543 |
2544 const AtomicString& autocapitalize = formElement->autocapitalize(); | 2544 const AtomicString& autocapitalize = formElement->autocapitalize(); |
2545 if (autocapitalize == none) | 2545 if (autocapitalize == none) |
2546 flags |= WebTextInputFlagAutocapitalizeNone; | 2546 flags |= WebTextInputFlagAutocapitalizeNone; |
2547 else if (autocapitalize == characters) | 2547 else if (autocapitalize == characters) |
2548 flags |= WebTextInputFlagAutocapitalizeCharacters; | 2548 flags |= WebTextInputFlagAutocapitalizeCharacters; |
2549 else if (autocapitalize == words) | 2549 else if (autocapitalize == words) |
2550 flags |= WebTextInputFlagAutocapitalizeWords; | 2550 flags |= WebTextInputFlagAutocapitalizeWords; |
2551 else if (autocapitalize == sentences) | 2551 else if (autocapitalize == sentences) |
2552 flags |= WebTextInputFlagAutocapitalizeSentences; | 2552 flags |= WebTextInputFlagAutocapitalizeSentences; |
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4564 { | 4564 { |
4565 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4565 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4566 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4566 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4567 if (!page()) | 4567 if (!page()) |
4568 return 1; | 4568 return 1; |
4569 | 4569 |
4570 return page()->deviceScaleFactor(); | 4570 return page()->deviceScaleFactor(); |
4571 } | 4571 } |
4572 | 4572 |
4573 } // namespace blink | 4573 } // namespace blink |
OLD | NEW |