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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 #include "platform/graphics/Color.h" | 109 #include "platform/graphics/Color.h" |
110 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 110 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
111 #include "platform/graphics/Image.h" | 111 #include "platform/graphics/Image.h" |
112 #include "platform/graphics/ImageBuffer.h" | 112 #include "platform/graphics/ImageBuffer.h" |
113 #include "platform/scroll/ScrollbarTheme.h" | 113 #include "platform/scroll/ScrollbarTheme.h" |
114 #include "platform/weborigin/SchemeRegistry.h" | 114 #include "platform/weborigin/SchemeRegistry.h" |
115 #include "public/platform/Platform.h" | 115 #include "public/platform/Platform.h" |
116 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" | 116 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" |
117 #include "public/platform/WebDragData.h" | 117 #include "public/platform/WebDragData.h" |
118 #include "public/platform/WebFloatPoint.h" | 118 #include "public/platform/WebFloatPoint.h" |
119 #include "public/platform/WebFocusType.h" | |
119 #include "public/platform/WebGestureCurve.h" | 120 #include "public/platform/WebGestureCurve.h" |
120 #include "public/platform/WebImage.h" | 121 #include "public/platform/WebImage.h" |
121 #include "public/platform/WebLayerTreeView.h" | 122 #include "public/platform/WebLayerTreeView.h" |
122 #include "public/platform/WebURLRequest.h" | 123 #include "public/platform/WebURLRequest.h" |
123 #include "public/platform/WebVector.h" | 124 #include "public/platform/WebVector.h" |
124 #include "public/web/WebAXObject.h" | 125 #include "public/web/WebAXObject.h" |
125 #include "public/web/WebActiveWheelFlingParameters.h" | 126 #include "public/web/WebActiveWheelFlingParameters.h" |
126 #include "public/web/WebAutofillClient.h" | 127 #include "public/web/WebAutofillClient.h" |
127 #include "public/web/WebBeginFrameArgs.h" | 128 #include "public/web/WebBeginFrameArgs.h" |
128 #include "public/web/WebFrameClient.h" | 129 #include "public/web/WebFrameClient.h" |
(...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2508 flags |= WebTextInputFlagAutocapitalizeCharacters; | 2509 flags |= WebTextInputFlagAutocapitalizeCharacters; |
2509 else if (autocapitalize == words) | 2510 else if (autocapitalize == words) |
2510 flags |= WebTextInputFlagAutocapitalizeWords; | 2511 flags |= WebTextInputFlagAutocapitalizeWords; |
2511 else if (autocapitalize == sentences) | 2512 else if (autocapitalize == sentences) |
2512 flags |= WebTextInputFlagAutocapitalizeSentences; | 2513 flags |= WebTextInputFlagAutocapitalizeSentences; |
2513 else | 2514 else |
2514 ASSERT_NOT_REACHED(); | 2515 ASSERT_NOT_REACHED(); |
2515 } | 2516 } |
2516 } | 2517 } |
2517 | 2518 |
2519 if (wantEnterEvents(element)) | |
2520 flags |= WebTextInputFlagWantEnterEvents; | |
2521 | |
2522 if (haveNextInput(element, WebFocusTypeForward)) | |
2523 flags |= WebTextInputFlagHaveNextInput; | |
2524 | |
2525 if (haveNextInput(element, WebFocusTypeBackward)) | |
2526 flags |= WebTextInputFlagHavePreviousInput; | |
2527 | |
2518 return flags; | 2528 return flags; |
2519 } | 2529 } |
2520 | 2530 |
2531 Element* WebViewImpl::haveNextInput(Element* element, WebFocusType focusType) | |
2532 { | |
2533 if (!element->isFormControlElement()) | |
2534 return nullptr; | |
2535 | |
2536 HTMLFormControlElement* formControlElement = toHTMLFormControlElement(elemen t); | |
2537 Node* parentFormNode = reinterpret_cast<Node*>(formControlElement->formOwner ()); | |
2538 if (!parentFormNode) | |
2539 return nullptr; | |
2540 | |
2541 Node* nextNode = element; | |
2542 while ((nextNode = page()->focusController().findFocusableNode(focusType, *n extNode))) { | |
2543 if (nextNode->isDescendantOf(parentFormNode)) { | |
2544 LayoutObject* layout = nextNode->layoutObject(); | |
2545 if (nextNode->isContentEditable() || (layout && layout->isTextContro l())) { | |
2546 // TODO(AKV) Extend it for Select element, Radio button and Chec k boxes | |
2547 if (nextNode->isElementNode()) | |
2548 return toElement(nextNode); | |
2549 } | |
2550 } else { | |
2551 // TODO(AKV) Do we need to quit as and when we found a node which is not child of this form. (Need to discuss with Kochi) | |
kochi
2015/04/14 05:08:30
Yeah, I think once you go out of the current form,
AKV
2015/04/14 06:01:47
Thanks. I did same :)
| |
2552 } | |
2553 } | |
2554 return nullptr; | |
2555 } | |
2556 | |
2557 bool WebViewImpl::wantEnterEvents(Element* element) | |
2558 { | |
2559 if (!element->isFormControlElement()) | |
2560 return false; | |
2561 | |
2562 return (element->hasEventListeners(EventTypeNames::keydown) || element->hasE ventListeners(EventTypeNames::keypress) || element->hasEventListeners(EventTypeN ames::keystatuseschange) || element->hasEventListeners(EventTypeNames::keyup)); | |
2563 } | |
2564 | |
2565 void WebViewImpl::advanceFocusToNextInputField(WebFocusType focusType) | |
2566 { | |
2567 Element* element = focusedElement(); | |
2568 if (!element) | |
2569 return; | |
2570 | |
2571 Element* nextElement = haveNextInput(element, focusType); | |
2572 if (!nextElement) | |
2573 return; | |
2574 | |
2575 nextElement->scrollIntoViewIfNeeded(true /*centerIfNeeded*/); | |
2576 nextElement->dispatchSimulatedClick(0, SendMouseUpDownEvents); | |
2577 nextElement->focus(false, focusType); | |
2578 } | |
2579 | |
2521 WebString WebViewImpl::inputModeOfFocusedElement() | 2580 WebString WebViewImpl::inputModeOfFocusedElement() |
2522 { | 2581 { |
2523 if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) | 2582 if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) |
2524 return WebString(); | 2583 return WebString(); |
2525 | 2584 |
2526 Element* element = focusedElement(); | 2585 Element* element = focusedElement(); |
2527 if (!element) | 2586 if (!element) |
2528 return WebString(); | 2587 return WebString(); |
2529 | 2588 |
2530 if (isHTMLInputElement(*element)) { | 2589 if (isHTMLInputElement(*element)) { |
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4511 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4570 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4512 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4571 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
4513 } | 4572 } |
4514 | 4573 |
4515 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4574 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4516 { | 4575 { |
4517 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4576 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4518 } | 4577 } |
4519 | 4578 |
4520 } // namespace blink | 4579 } // namespace blink |
OLD | NEW |