Commit 5312f6f0 authored by tkent@chromium.org's avatar tkent@chromium.org

Revert of Adding support for Smart GO NEXT feature in Android Chrome (patchset...

Revert of Adding support for Smart GO NEXT feature in Android Chrome (patchset #23 id:460001 of https://codereview.chromium.org/939603002/ )

Reason for revert:
Regression in power.android_acceptance.
crbug.com/520952


Original issue's description:
> Adding support for Smart GO NEXT feature in Android Chrome
> 
> This change takes care of providing easy navigation among text input
> elements inside a form.
> 
> Corresponding changes to control the PREVIOUS, NEXT and GO button is done
> at https://codereview.chromium.org/1080693002/
> 
> BUG=410785
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=200398

TBR=kochi@chromium.org,l.gombos@samsung.com,ajith.v@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=410785,520952

Review URL: https://codereview.chromium.org/1303123002

git-svn-id: svn://svn.chromium.org/blink/trunk@200948 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5b066328
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "core/InputTypeNames.h" #include "core/InputTypeNames.h"
#include "core/clipboard/DataObject.h" #include "core/clipboard/DataObject.h"
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/dom/ElementTraversal.h"
#include "core/dom/Fullscreen.h" #include "core/dom/Fullscreen.h"
#include "core/dom/LayoutTreeBuilderTraversal.h" #include "core/dom/LayoutTreeBuilderTraversal.h"
#include "core/dom/Text.h" #include "core/dom/Text.h"
...@@ -62,7 +61,6 @@ ...@@ -62,7 +61,6 @@
#include "core/frame/SmartClip.h" #include "core/frame/SmartClip.h"
#include "core/frame/TopControls.h" #include "core/frame/TopControls.h"
#include "core/frame/VisualViewport.h" #include "core/frame/VisualViewport.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h" #include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMediaElement.h" #include "core/html/HTMLMediaElement.h"
#include "core/html/HTMLPlugInElement.h" #include "core/html/HTMLPlugInElement.h"
...@@ -2493,78 +2491,9 @@ int WebViewImpl::textInputFlags() ...@@ -2493,78 +2491,9 @@ int WebViewImpl::textInputFlags()
} }
} }
if (isListeningToKeyboardEvents(element))
flags |= WebTextInputFlagListeningToKeyboardEvents;
if (nextFocusableElementInForm(element, WebFocusTypeForward))
flags |= WebTextInputFlagHaveNextFocusableElement;
if (nextFocusableElementInForm(element, WebFocusTypeBackward))
flags |= WebTextInputFlagHavePreviousFocusableElement;
return flags; return flags;
} }
Element* WebViewImpl::nextFocusableElementInForm(Element* element, WebFocusType focusType)
{
if (!element->isFormControlElement() && !element->isContentEditable())
return nullptr;
HTMLFormElement* formOwner = nullptr;
if (element->isContentEditable())
formOwner = Traversal<HTMLFormElement>::firstAncestor(*element);
else
formOwner = toHTMLFormControlElement(element)->formOwner();
if (!formOwner)
return nullptr;
Element* nextElement = element;
for (nextElement = page()->focusController().findFocusableElement(focusType, *nextElement); nextElement; nextElement = page()->focusController().findFocusableElement(focusType, *nextElement)) {
if (nextElement->isContentEditable() && nextElement->isDescendantOf(formOwner))
return nextElement;
if (!nextElement->isFormControlElement())
continue;
HTMLFormControlElement* formElement = toHTMLFormControlElement(nextElement);
if (formElement->formOwner() != formOwner)
continue;
// Skip disabled or readonly editable elements.
if (formElement->isDisabledOrReadOnly())
continue;
LayoutObject* layout = nextElement->layoutObject();
if (layout && layout->isTextControl()) {
// TODO(ajith.v) Extend it for Select element, Radio button and Check boxes
return nextElement;
}
}
return nullptr;
}
bool WebViewImpl::isListeningToKeyboardEvents(Element* element)
{
if (!element->isFormControlElement() && !element->isContentEditable())
return false;
for (Node* node = element; node; node = node->parentNode()) {
if (node->hasEventListeners(EventTypeNames::keydown) || node->hasEventListeners(EventTypeNames::keypress) || node->hasEventListeners(EventTypeNames::keyup))
return true;
}
return false;
}
void WebViewImpl::advanceFocusInForm(WebFocusType focusType)
{
Element* element = focusedElement();
if (!element)
return;
RefPtrWillBeRawPtr<Element> nextElement = nextFocusableElementInForm(element, focusType);
if (!nextElement)
return;
nextElement->scrollIntoViewIfNeeded(true /*centerIfNeeded*/);
nextElement->focus(false, focusType);
}
WebString WebViewImpl::inputModeOfFocusedElement() WebString WebViewImpl::inputModeOfFocusedElement()
{ {
if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) if (!RuntimeEnabledFeatures::inputModeAttributeEnabled())
......
...@@ -188,7 +188,6 @@ public: ...@@ -188,7 +188,6 @@ public:
bool scrollFocusedNodeIntoRect(const WebRect&) override; bool scrollFocusedNodeIntoRect(const WebRect&) override;
void smoothScroll(int targetX, int targetY, long durationMs) override; void smoothScroll(int targetX, int targetY, long durationMs) override;
void zoomToFindInPageRect(const WebRect&); void zoomToFindInPageRect(const WebRect&);
void advanceFocusInForm(WebFocusType) override;
void advanceFocus(bool reverse) override; void advanceFocus(bool reverse) override;
double zoomLevel() override; double zoomLevel() override;
double setZoomLevel(double) override; double setZoomLevel(double) override;
...@@ -565,8 +564,6 @@ private: ...@@ -565,8 +564,6 @@ private:
WebTextInputType textInputType(); WebTextInputType textInputType();
int textInputFlags(); int textInputFlags();
Element* nextFocusableElementInForm(Element*, WebFocusType);
bool isListeningToKeyboardEvents(Element*);
WebString inputModeOfFocusedElement(); WebString inputModeOfFocusedElement();
......
...@@ -3051,318 +3051,4 @@ TEST_F(WebViewTest, TestRecordFrameTimingEvents) ...@@ -3051,318 +3051,4 @@ TEST_F(WebViewTest, TestRecordFrameTimingEvents)
} }
} }
TEST_F(WebViewTest, MoveFocusToNextFocusableElementInFormWithKeyEventListenersAndNonEditableElements)
{
const std::string testFile = "advance_focus_in_form_with_key_event_listeners.html";
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile.c_str()));
WebView* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, nullptr);
webViewImpl->setInitialFocus(false);
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame());
HTMLDocument* document = toHTMLDocument(frame->frame()->document());
const int defaultTextInputFlags = WebTextInputFlagAutocapitalizeSentences;
struct FocusedElement {
const char* elementId;
int textInputFlags;
} focusedElements[] = {
{"input1", defaultTextInputFlags | WebTextInputFlagHaveNextFocusableElement},
{"contenteditable1", WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement},
{"input2", defaultTextInputFlags | WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement | WebTextInputFlagListeningToKeyboardEvents},
{"textarea1", defaultTextInputFlags | WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement},
{"input3", defaultTextInputFlags | WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement},
{"textarea2", defaultTextInputFlags | WebTextInputFlagHavePreviousFocusableElement},
};
// Forward Navigation in form1 with NEXT
Element* input1 = document->getElementById("input1");
input1->focus();
Element* currentFocus = nullptr;
WebTextInputInfo textInputInfo;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
}
// Now focus will stay on previous focus itself, because it has no next
// element.
EXPECT_EQ(currentFocus, document->focusedElement());
// Backward Navigation in form1 with PREVIOUS
for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
}
// Now focus will stay on previous focus itself, because it has no previous
// element.
EXPECT_EQ(currentFocus, document->focusedElement());
// Setting a non editable element as focus in form1, and ensuring editable
// navigation is fine in forward and backward.
Element* button1 = document->getElementById("button1");
button1->focus();
textInputInfo = webViewImpl->textInputInfo();
// No Next/Previous element for elements outside form.
EXPECT_EQ(0, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
Element* contenteditable1 = document->getElementById("contenteditable1");
EXPECT_EQ(contenteditable1, document->focusedElement());
button1->focus();
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
EXPECT_EQ(input1, document->focusedElement());
Element* anchor1 = document->getElementById("anchor1");
anchor1->focus();
textInputInfo = webViewImpl->textInputInfo();
// No Next/Previous element for elements outside form.
EXPECT_EQ(0, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
// Since anchor is not a form control element, next/previous element will
// be null, hence focus will stay same as it is.
EXPECT_EQ(anchor1, document->focusedElement());
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
EXPECT_EQ(anchor1, document->focusedElement());
// Navigation of elements which is not part of any forms.
Element* textarea3 = document->getElementById("textarea3");
textarea3->focus();
textInputInfo = webViewImpl->textInputInfo();
// No Next/Previous element for elements outside form.
EXPECT_EQ(defaultTextInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
// No Next/Previous element to this element because it's not part of any
// form. Hence focus won't change wrt NEXT/PREVIOUS.
EXPECT_EQ(textarea3, document->focusedElement());
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
EXPECT_EQ(textarea3, document->focusedElement());
// Navigation from an element which is part of a form but not an editable
// element.
Element* button2 = document->getElementById("button2");
button2->focus();
textInputInfo = webViewImpl->textInputInfo();
// No Next element for this element, due to last element outside the form.
EXPECT_EQ(0, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
// No Next element to this element because it's not part of any form.
// Hence focus won't change wrt NEXT.
EXPECT_EQ(button2, document->focusedElement());
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
// Since button is a form control element from form1, ensuring focus is set
// at correct position.
Element* textarea2 = document->getElementById("textarea2");
EXPECT_EQ(textarea2, document->focusedElement());
Element* contenteditable2 = document->getElementById("contenteditable2");
document->setFocusedElement(contenteditable2);
textInputInfo = webViewImpl->textInputInfo();
// No Next/Previous element for elements outside form.
EXPECT_EQ(0, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
// No Next/Previous element to this element because it's not part of any
// form. Hence focus won't change wrt NEXT/PREVIOUS.
EXPECT_EQ(contenteditable2, document->focusedElement());
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
EXPECT_EQ(contenteditable2, document->focusedElement());
// Navigation of elements which is having invalid form attribute and hence
// not part of any forms.
Element* textarea4 = document->getElementById("textarea4");
textarea4->focus();
textInputInfo = webViewImpl->textInputInfo();
// No Next/Previous element for elements which is having invalid form
// attribute.
EXPECT_EQ(defaultTextInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
// No Next/Previous element to this element because it's not part of any
// form. Hence focus won't change wrt NEXT/PREVIOUS.
EXPECT_EQ(textarea4, document->focusedElement());
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
EXPECT_EQ(textarea4, document->focusedElement());
m_webViewHelper.reset();
}
TEST_F(WebViewTest, MoveFocusToNextFocusableElementInFormWithNonEditableNonFormControlElements)
{
const std::string testFile = "advance_focus_in_form_with_key_event_listeners.html";
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile.c_str()));
WebView* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, nullptr);
webViewImpl->setInitialFocus(false);
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame());
HTMLDocument* document = toHTMLDocument(frame->frame()->document());
const int defaultTextInputFlags = WebTextInputFlagAutocapitalizeSentences;
struct FocusedElement {
const char* elementId;
int textInputFlags;
} focusedElements[] = {
{"textarea5", defaultTextInputFlags | WebTextInputFlagListeningToKeyboardEvents | WebTextInputFlagHaveNextFocusableElement},
{"input4", defaultTextInputFlags | WebTextInputFlagListeningToKeyboardEvents | WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement},
{"contenteditable3", WebTextInputFlagListeningToKeyboardEvents | WebTextInputFlagHavePreviousFocusableElement},
};
// Forward Navigation in form2 with NEXT
Element* textarea5 = document->getElementById("textarea5");
textarea5->focus();
Element* currentFocus = nullptr;
WebTextInputInfo textInputInfo;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
}
// Now focus will stay on previous focus itself, because it has no next
// element.
EXPECT_EQ(currentFocus, document->focusedElement());
// Backward Navigation in form1 with PREVIOUS
for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
}
// Now focus will stay on previous focus itself, because it has no previous
// element.
EXPECT_EQ(currentFocus, document->focusedElement());
// Setting a non editable element as focus in form1, and ensuring editable
// navigation is fine in forward and backward.
Element* anchor2 = document->getElementById("anchor2");
anchor2->focus();
textInputInfo = webViewImpl->textInputInfo();
// No Next/Previous element for elements outside form.
EXPECT_EQ(0, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
// No editable element after this inside the form, hence focus won't change.
EXPECT_EQ(anchor2, document->focusedElement());
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
// Since anchor is not a form control element, next/previous element will
// be null, hence focus will stay same as it is.
EXPECT_EQ(anchor2, document->focusedElement());
m_webViewHelper.reset();
}
TEST_F(WebViewTest, MoveFocusToNextFocusableElementInFormWithTabIndexElements)
{
const std::string testFile = "advance_focus_in_form_with_tabindex_elements.html";
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile.c_str()));
WebView* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, nullptr);
webViewImpl->setInitialFocus(false);
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame());
HTMLDocument* document = toHTMLDocument(frame->frame()->document());
const int defaultTextInputFlags = WebTextInputFlagAutocapitalizeSentences;
struct FocusedElement {
const char* elementId;
int textInputFlags;
} focusedElements[] = {
{"textarea6", defaultTextInputFlags | WebTextInputFlagHaveNextFocusableElement},
{"input5", defaultTextInputFlags | WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement},
{"contenteditable4", WebTextInputFlagHaveNextFocusableElement | WebTextInputFlagHavePreviousFocusableElement},
{"input6", defaultTextInputFlags | WebTextInputFlagHavePreviousFocusableElement},
};
// Forward Navigation in form with NEXT which has tabindex attribute
// which differs visual order.
Element* textarea6 = document->getElementById("textarea6");
textarea6->focus();
Element* currentFocus = nullptr;
WebTextInputInfo textInputInfo;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
}
// No next editable element which is focusable with proper tab index, hence
// staying on previous focus.
EXPECT_EQ(currentFocus, document->focusedElement());
// Backward Navigation in form with PREVIOUS which has tabindex attribute
// which differs visual order.
for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
}
// Now focus will stay on previous focus itself, because it has no previous
// element.
EXPECT_EQ(currentFocus, document->focusedElement());
// Setting an element which has invalid tabindex and ensuring it is not
// modifying further navigation.
Element* contenteditable5 = document->getElementById("contenteditable5");
contenteditable5->focus();
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
Element* input6 = document->getElementById("input6");
EXPECT_EQ(input6, document->focusedElement());
contenteditable5->focus();
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
EXPECT_EQ(textarea6, document->focusedElement());
m_webViewHelper.reset();
}
TEST_F(WebViewTest, MoveFocusToNextFocusableElementInFormWithDisabledAndReadonlyElements)
{
const std::string testFile = "advance_focus_in_form_with_disabled_and_readonly_elements.html";
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile.c_str()));
WebView* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, nullptr);
webViewImpl->setInitialFocus(false);
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame());
HTMLDocument* document = toHTMLDocument(frame->frame()->document());
struct FocusedElement {
const char* elementId;
int textInputFlags;
} focusedElements[] = {
{"contenteditable6", WebTextInputFlagHaveNextFocusableElement},
{"contenteditable7", WebTextInputFlagHavePreviousFocusableElement},
};
// Forward Navigation in form with NEXT which has has disabled/enabled
// elements which will gets skipped during navigation.
Element* contenteditable6 = document->getElementById("contenteditable6");
contenteditable6->focus();
Element* currentFocus = nullptr;
WebTextInputInfo textInputInfo;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeForward);
}
// No next editable element which is focusable, hence staying on previous
// focus.
EXPECT_EQ(currentFocus, document->focusedElement());
// Backward Navigation in form with PREVIOUS which has has
// disabled/enabled elements which will gets skipped during navigation.
for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) {
currentFocus = document->getElementById(focusedElements[i].elementId);
EXPECT_EQ(currentFocus, document->focusedElement());
textInputInfo = webViewImpl->textInputInfo();
EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags);
webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
}
// Now focus will stay on previous focus itself, because it has no previous
// element.
EXPECT_EQ(currentFocus, document->focusedElement());
m_webViewHelper.reset();
}
} // namespace blink } // namespace blink
<html>
<body>
<form id="form1">
<div id="contenteditable6" contenteditable="true">contenteditable6 from form4</div><br>
<input type="text" id="input7" disabled value="input7 from form4 but skipped due to disabled element"><br>
<input type="text" id="input8" readonly value="input8 from form4 but skipped due to readonly element"><br>
<textarea id="textarea7" disabled readonly>textarea7 from form4 but skipped due to disabled and readonly element</textarea><br>
<div id="contenteditable7" contenteditable="true">contenteditable7 from form4</div><br>
</form>
</body>
</html>
<html>
<body>
<!-- If any of these form element can handle key event, software keyboard should show ENTER key
instead of GO key, for textarea element it's exceptional, as it requires ENTER key by default
for enabling multiline inputs. (This will be determined from Chromium layer)" -->
<h3>form1 starts here</h3>
<form id="form1">
<input type="text" id="input1" form="form1" value="input1 from form1"><br>
<button type="button" id="button1" form="form1">button1 from form1</button><br>
<div id="contenteditable1" contenteditable="true">contenteditable1 from form1</div><br>
<div id="div1" onkeypress="alert('if key event is handled, software keyboard should show ENTER key instead of GO key');"><br>
<input type="text" id="input2" value="input2 from div1 form1"><br>
</div>
<a href="#" id="anchor1">anchor1 from form1</a><br>
<textarea id="textarea1">textarea1 from form1</textarea><br>
<input type="text" id="input3" value="input3 from form1"><br>
</form>
<h3>form1 ends here</h3>
<textarea id="textarea2" form="form1">textarea2 from form1, which is outside parent hierarchy</textarea><br>
<textarea id="textarea3">textarea3 neither from form1 nor from form2</textarea><br>
<button type="button" id="button2" form="form1">button2 from form1, which is outside parent hierarchy, but can't navigate due to non-editable element</button><br>
<div id="contenteditable2" contenteditable="true">contenteditable2 neither from form1 nor from form2</div><br>
<textarea id="textarea4" form="formInvalid">textarea4 neither from form1 nor from form2, form attribute is invalid</textarea><br>
<h3>form2 starts here</h3><br>
<form id="form2" onkeypress="alert('if key event is handled, software keyboard should show ENTER key instead of GO key');">
<textarea id="textarea5">textarea5 from form2</textarea><br>
<input type="text" id="input4" value="input4 from form2"><br>
<div id="contenteditable3" contenteditable="true">contenteditable3 from form2</div><br>
<a href="#" id="anchor2">anchor2 from form2</a><br>
</form>
<h3>form2 ends here</h3><br>
</body>
</html>
<html>
<body>
<form id="form1">
<input type="text" id="input5" value="input5 from form3" tabindex="2"><br>
<div id="contenteditable4" contenteditable="true" tabindex="3">contenteditable4 from form3</div><br>
<a href="#" id="anchor3" tabindex="4">anchor3 from form3</a><br>
<textarea id="textarea6" tabindex="1">textarea6 from form3</textarea><br>
<div id="contenteditable5" contenteditable="true" tabindex="-1">contenteditable5 from form3, but not considered for navigation due to invalid tabindex</div><br>
<input type="text" id="input6" value="input6 from form3" tabindex="5"><br>
</form>
</body>
</html>
...@@ -85,10 +85,7 @@ enum WebTextInputFlags { ...@@ -85,10 +85,7 @@ enum WebTextInputFlags {
WebTextInputFlagAutocapitalizeNone = 1 << 6, WebTextInputFlagAutocapitalizeNone = 1 << 6,
WebTextInputFlagAutocapitalizeCharacters = 1 << 7, WebTextInputFlagAutocapitalizeCharacters = 1 << 7,
WebTextInputFlagAutocapitalizeWords = 1 << 8, WebTextInputFlagAutocapitalizeWords = 1 << 8,
WebTextInputFlagAutocapitalizeSentences = 1 << 9, WebTextInputFlagAutocapitalizeSentences = 1 << 9
WebTextInputFlagListeningToKeyboardEvents = 1 << 10,
WebTextInputFlagHaveNextFocusableElement = 1 << 11,
WebTextInputFlagHavePreviousFocusableElement = 1 << 12
}; };
} // namespace blink } // namespace blink
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "../platform/WebColor.h" #include "../platform/WebColor.h"
#include "../platform/WebDisplayMode.h" #include "../platform/WebDisplayMode.h"
#include "../platform/WebFocusType.h"
#include "../platform/WebPageVisibilityState.h" #include "../platform/WebPageVisibilityState.h"
#include "../platform/WebString.h" #include "../platform/WebString.h"
#include "../platform/WebVector.h" #include "../platform/WebVector.h"
...@@ -181,12 +180,6 @@ public: ...@@ -181,12 +180,6 @@ public:
// Smooth scroll the root layer to |targetX|, |targetY| in |durationMs|. // Smooth scroll the root layer to |targetX|, |targetY| in |durationMs|.
virtual void smoothScroll(int targetX, int targetY, long durationMs) { } virtual void smoothScroll(int targetX, int targetY, long durationMs) { }
// Advance the focus of the WebView to next text input element from current
// input field wrt sequential navigation with TAB or Shift + TAB
// WebFocusTypeForward simulates TAB and WebFocusTypeBackward simulates
// Shift + TAB. (Will be extended to other form Controls like Select element, Checkbox, Radio etc.)
virtual void advanceFocusInForm(WebFocusType focusType) {}
// Advance the focus of the WebView forward to the next element or to the // Advance the focus of the WebView forward to the next element or to the
// previous element in the tab sequence (if reverse is true). // previous element in the tab sequence (if reverse is true).
virtual void advanceFocus(bool reverse) { } virtual void advanceFocus(bool reverse) { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment