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 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2512 flags |= WebTextInputFlagAutocapitalizeCharacters; | 2513 flags |= WebTextInputFlagAutocapitalizeCharacters; |
2513 else if (autocapitalize == words) | 2514 else if (autocapitalize == words) |
2514 flags |= WebTextInputFlagAutocapitalizeWords; | 2515 flags |= WebTextInputFlagAutocapitalizeWords; |
2515 else if (autocapitalize == sentences) | 2516 else if (autocapitalize == sentences) |
2516 flags |= WebTextInputFlagAutocapitalizeSentences; | 2517 flags |= WebTextInputFlagAutocapitalizeSentences; |
2517 else | 2518 else |
2518 ASSERT_NOT_REACHED(); | 2519 ASSERT_NOT_REACHED(); |
2519 } | 2520 } |
2520 } | 2521 } |
2521 | 2522 |
2523 if (wantEnterEvents(element)) | |
2524 flags |= WebTextInputFlagWantEnterEvents; | |
2525 | |
2526 if (haveNextInput(element, WebFocusTypeForward)) | |
2527 flags |= WebTextInputFlagHaveNextInput; | |
2528 | |
2529 if (haveNextInput(element, WebFocusTypeBackward)) | |
2530 flags |= WebTextInputFlagHavePreviousInput; | |
2531 | |
2522 return flags; | 2532 return flags; |
2523 } | 2533 } |
2524 | 2534 |
2535 Element* WebViewImpl::haveNextInput(Element* element, WebFocusType focusType) | |
tkent
2015/04/14 23:27:19
The function name is not reasonable.
- The name lo
AKV
2015/04/16 19:05:19
Done. nextFocusableElement is ideal. Thanks :)
| |
2536 { | |
2537 if (!element->isFormControlElement()) | |
tkent
2015/04/14 23:27:19
Do you want to reject a contenteditable element th
AKV
2015/04/16 19:05:19
I care about elements which are inside the form. I
tkent
2015/04/17 04:12:35
IsFormControlElement() return false for contentedi
| |
2538 return nullptr; | |
2539 | |
2540 HTMLFormControlElement* formControlElement = toHTMLFormControlElement(elemen t); | |
2541 Node* parentFormNode = reinterpret_cast<Node*>(formControlElement->formOwner ()); | |
tkent
2015/04/14 23:27:19
|parentFormNode| is not a good name because it's n
AKV
2015/04/16 19:05:19
Done.
| |
2542 if (!parentFormNode) | |
2543 return nullptr; | |
2544 | |
2545 Node* nextNode = element; | |
2546 while ((nextNode = page()->focusController().findFocusableNode(focusType, *n extNode))) { | |
2547 if (!nextNode->isDescendantOf(parentFormNode)) | |
tkent
2015/04/14 23:27:19
This doesn't work for the following case.
<form i
kochi
2015/04/15 01:09:18
Hmm, I was not aware of this way of declaring form
AKV
2015/04/16 19:05:19
Thanks. I have taken care this case by checking fo
AKV
2015/04/16 19:05:19
Thanks. I have taken care this case by checking fo
| |
2548 return nullptr; | |
2549 LayoutObject* layout = nextNode->layoutObject(); | |
2550 if (nextNode->isContentEditable() || (layout && layout->isTextControl()) ) { | |
2551 // TODO(AKV) Extend it for Select element, Radio button and Check bo xes | |
2552 if (nextNode->isElementNode()) | |
tkent
2015/04/14 23:27:19
No need to check isElementNode. Only elements are
AKV
2015/04/16 19:05:19
Done.
| |
2553 return toElement(nextNode); | |
2554 } | |
2555 } | |
2556 return nullptr; | |
2557 } | |
2558 | |
2559 bool WebViewImpl::wantEnterEvents(Element* element) | |
tkent
2015/04/14 23:27:19
The argument should be |const Element&|.
The func
AKV
2015/04/16 19:05:19
I wanted to check whether the element has any list
tkent
2015/04/17 04:12:35
No way to check only Enter key.
BTW, If we don't
| |
2560 { | |
2561 if (!element->isFormControlElement()) | |
2562 return false; | |
2563 | |
2564 return (element->hasEventListeners(EventTypeNames::keydown) || element->hasE ventListeners(EventTypeNames::keypress) || element->hasEventListeners(EventTypeN ames::keystatuseschange) || element->hasEventListeners(EventTypeNames::keyup)); | |
tkent
2015/04/14 23:27:19
Why do you check keystatuschange event, which is f
AKV
2015/04/16 19:05:19
Right. this is not required.
| |
2565 } | |
2566 | |
2567 void WebViewImpl::advanceFocusToNextInputField(WebFocusType focusType) | |
2568 { | |
2569 Element* element = focusedElement(); | |
2570 if (!element) | |
2571 return; | |
2572 | |
2573 Element* nextElement = haveNextInput(element, focusType); | |
2574 if (!nextElement) | |
2575 return; | |
2576 | |
2577 nextElement->scrollIntoViewIfNeeded(true /*centerIfNeeded*/); | |
2578 nextElement->dispatchSimulatedClick(0, SendMouseUpDownEvents); | |
tkent
2015/04/14 23:27:19
0 -> nullptr.
Why do you need to dispatch a click
AKV
2015/04/16 19:05:19
Not required. Thanks.
| |
2579 nextElement->focus(false, focusType); | |
tkent
2015/04/14 23:27:19
The click event handler can delete |nextElement|.
AKV
2015/04/16 19:05:19
Thanks. I corrected it.
| |
2580 } | |
2581 | |
2525 WebString WebViewImpl::inputModeOfFocusedElement() | 2582 WebString WebViewImpl::inputModeOfFocusedElement() |
2526 { | 2583 { |
2527 if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) | 2584 if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) |
2528 return WebString(); | 2585 return WebString(); |
2529 | 2586 |
2530 Element* element = focusedElement(); | 2587 Element* element = focusedElement(); |
2531 if (!element) | 2588 if (!element) |
2532 return WebString(); | 2589 return WebString(); |
2533 | 2590 |
2534 if (isHTMLInputElement(*element)) { | 2591 if (isHTMLInputElement(*element)) { |
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4512 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4569 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4513 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4570 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
4514 } | 4571 } |
4515 | 4572 |
4516 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4573 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4517 { | 4574 { |
4518 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4575 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4519 } | 4576 } |
4520 | 4577 |
4521 } // namespace blink | 4578 } // namespace blink |
OLD | NEW |