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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "web/WebViewImpl.h" | 32 #include "web/WebViewImpl.h" |
33 | 33 |
34 #include "core/CSSValueKeywords.h" | 34 #include "core/CSSValueKeywords.h" |
35 #include "core/HTMLNames.h" | 35 #include "core/HTMLNames.h" |
| 36 #include "core/InputTypeNames.h" |
36 #include "core/accessibility/AXObjectCache.h" | 37 #include "core/accessibility/AXObjectCache.h" |
37 #include "core/clipboard/DataObject.h" | 38 #include "core/clipboard/DataObject.h" |
38 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
39 #include "core/dom/DocumentMarkerController.h" | 40 #include "core/dom/DocumentMarkerController.h" |
40 #include "core/dom/NodeRenderingTraversal.h" | 41 #include "core/dom/NodeRenderingTraversal.h" |
41 #include "core/dom/Text.h" | 42 #include "core/dom/Text.h" |
42 #include "core/editing/Editor.h" | 43 #include "core/editing/Editor.h" |
43 #include "core/editing/FrameSelection.h" | 44 #include "core/editing/FrameSelection.h" |
44 #include "core/editing/HTMLInterchange.h" | 45 #include "core/editing/HTMLInterchange.h" |
45 #include "core/editing/InputMethodController.h" | 46 #include "core/editing/InputMethodController.h" |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 } | 2234 } |
2234 | 2235 |
2235 WebTextInputType WebViewImpl::textInputType() | 2236 WebTextInputType WebViewImpl::textInputType() |
2236 { | 2237 { |
2237 Element* element = focusedElement(); | 2238 Element* element = focusedElement(); |
2238 if (!element) | 2239 if (!element) |
2239 return WebTextInputTypeNone; | 2240 return WebTextInputTypeNone; |
2240 | 2241 |
2241 if (isHTMLInputElement(*element)) { | 2242 if (isHTMLInputElement(*element)) { |
2242 HTMLInputElement& input = toHTMLInputElement(*element); | 2243 HTMLInputElement& input = toHTMLInputElement(*element); |
| 2244 const AtomicString& type = input.type(); |
2243 | 2245 |
2244 if (input.isDisabledOrReadOnly()) | 2246 if (input.isDisabledOrReadOnly()) |
2245 return WebTextInputTypeNone; | 2247 return WebTextInputTypeNone; |
2246 | 2248 |
2247 if (input.isPasswordField()) | 2249 if (type == InputTypeNames::password) |
2248 return WebTextInputTypePassword; | 2250 return WebTextInputTypePassword; |
2249 if (input.isSearchField()) | 2251 if (type == InputTypeNames::search) |
2250 return WebTextInputTypeSearch; | 2252 return WebTextInputTypeSearch; |
2251 if (input.isEmailField()) | 2253 if (type == InputTypeNames::email) |
2252 return WebTextInputTypeEmail; | 2254 return WebTextInputTypeEmail; |
2253 if (input.isNumberField()) | 2255 if (type == InputTypeNames::number) |
2254 return WebTextInputTypeNumber; | 2256 return WebTextInputTypeNumber; |
2255 if (input.isTelephoneField()) | 2257 if (type == InputTypeNames::tel) |
2256 return WebTextInputTypeTelephone; | 2258 return WebTextInputTypeTelephone; |
2257 if (input.isURLField()) | 2259 if (type == InputTypeNames::url) |
2258 return WebTextInputTypeURL; | 2260 return WebTextInputTypeURL; |
2259 if (input.isDateField()) | 2261 if (type == InputTypeNames::date) |
2260 return WebTextInputTypeDate; | 2262 return WebTextInputTypeDate; |
2261 if (input.isDateTimeLocalField()) | 2263 if (type == InputTypeNames::datetime_local) |
2262 return WebTextInputTypeDateTimeLocal; | 2264 return WebTextInputTypeDateTimeLocal; |
2263 if (input.isMonthField()) | 2265 if (type == InputTypeNames::month) |
2264 return WebTextInputTypeMonth; | 2266 return WebTextInputTypeMonth; |
2265 if (input.isTimeField()) | 2267 if (type == InputTypeNames::time) |
2266 return WebTextInputTypeTime; | 2268 return WebTextInputTypeTime; |
2267 if (input.isWeekField()) | 2269 if (type == InputTypeNames::week) |
2268 return WebTextInputTypeWeek; | 2270 return WebTextInputTypeWeek; |
2269 if (input.isTextField()) | 2271 if (type == InputTypeNames::text) |
2270 return WebTextInputTypeText; | 2272 return WebTextInputTypeText; |
2271 | 2273 |
2272 return WebTextInputTypeNone; | 2274 return WebTextInputTypeNone; |
2273 } | 2275 } |
2274 | 2276 |
2275 if (isHTMLTextAreaElement(*element)) { | 2277 if (isHTMLTextAreaElement(*element)) { |
2276 if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly()) | 2278 if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly()) |
2277 return WebTextInputTypeNone; | 2279 return WebTextInputTypeNone; |
2278 return WebTextInputTypeTextArea; | 2280 return WebTextInputTypeTextArea; |
2279 } | 2281 } |
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4289 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4291 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4290 | 4292 |
4291 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4293 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4292 return false; | 4294 return false; |
4293 | 4295 |
4294 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4296 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4295 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4297 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4296 } | 4298 } |
4297 | 4299 |
4298 } // namespace blink | 4300 } // namespace blink |
OLD | NEW |