| OLD | NEW |
| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 TextFieldInputType::handleKeydownEvent(event); | 100 TextFieldInputType::handleKeydownEvent(event); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void SearchInputType::startSearchEventTimer() { | 103 void SearchInputType::startSearchEventTimer() { |
| 104 DCHECK(element().layoutObject()); | 104 DCHECK(element().layoutObject()); |
| 105 unsigned length = element().innerEditorValue().length(); | 105 unsigned length = element().innerEditorValue().length(); |
| 106 | 106 |
| 107 if (!length) { | 107 if (!length) { |
| 108 m_searchEventTimer.stop(); | 108 m_searchEventTimer.stop(); |
| 109 TaskRunnerHelper::get(TaskType::UserInteraction, &element().document()) | 109 TaskRunnerHelper::get(TaskType::UserInteraction, &element().document()) |
| 110 ->postTask(BLINK_FROM_HERE, WTF::bind(&HTMLInputElement::onSearch, | 110 ->postTask( |
| 111 wrapPersistent(&element()))); | 111 BLINK_FROM_HERE, |
| 112 WTF::bind(&HTMLInputElement::onSearch, wrapPersistent(&element()))); |
| 112 return; | 113 return; |
| 113 } | 114 } |
| 114 | 115 |
| 115 // After typing the first key, we wait 0.5 seconds. | 116 // After typing the first key, we wait 0.5 seconds. |
| 116 // After the second key, 0.4 seconds, then 0.3, then 0.2 from then on. | 117 // After the second key, 0.4 seconds, then 0.3, then 0.2 from then on. |
| 117 m_searchEventTimer.startOneShot(max(0.2, 0.6 - 0.1 * length), | 118 m_searchEventTimer.startOneShot(max(0.2, 0.6 - 0.1 * length), |
| 118 BLINK_FROM_HERE); | 119 BLINK_FROM_HERE); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void SearchInputType::dispatchSearchEvent() { | 122 void SearchInputType::dispatchSearchEvent() { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 button->removeInlineStyleProperty(CSSPropertyOpacity); | 165 button->removeInlineStyleProperty(CSSPropertyOpacity); |
| 165 button->removeInlineStyleProperty(CSSPropertyPointerEvents); | 166 button->removeInlineStyleProperty(CSSPropertyPointerEvents); |
| 166 } | 167 } |
| 167 } | 168 } |
| 168 | 169 |
| 169 bool SearchInputType::supportsInputModeAttribute() const { | 170 bool SearchInputType::supportsInputModeAttribute() const { |
| 170 return true; | 171 return true; |
| 171 } | 172 } |
| 172 | 173 |
| 173 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |