Skip to content
Permalink
Browse files
AX:[Mac] Unable to edit text input, textarea fields in iframe using V…
…O naivgation

https://bugs.webkit.org/show_bug.cgi?id=162999

Reviewed by Chris Fleizach.

Source/WebCore:

In WebKit1, the top web area setting the selection to an input element inside an iframe
will make the input field not editable. The issue is that when the web area and the input element
have different documents, the setSelection function in FrameSelection will set the selection on
the input's frame and cause the caret to disappear. I fixed it by not setting the selection in such case.

Test: accessibility/mac/wk1-set-selected-text-marker-range-input-element.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):

LayoutTests:

* accessibility/mac/wk1-set-selected-text-marker-range-input-element-expected.txt: Added.
* accessibility/mac/wk1-set-selected-text-marker-range-input-element.html: Added.


Canonical link: https://commits.webkit.org/180907@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206854 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Nan Wang committed Oct 6, 2016
1 parent 83cc606 commit 5126ce9c9c526c3e403e84395f80124eca2a54e5
Showing 6 changed files with 109 additions and 0 deletions.
@@ -1,3 +1,13 @@
2016-10-06 Nan Wang <n_wang@apple.com>

AX:[Mac] Unable to edit text input, textarea fields in iframe using VO naivgation
https://bugs.webkit.org/show_bug.cgi?id=162999

Reviewed by Chris Fleizach.

* accessibility/mac/wk1-set-selected-text-marker-range-input-element-expected.txt: Added.
* accessibility/mac/wk1-set-selected-text-marker-range-input-element.html: Added.

2016-10-05 Yusuke Suzuki <utatane.tea@gmail.com>

[JSC] Add @throwXXXError bytecode intrinsic
@@ -0,0 +1,11 @@

This makes sure that in WK1 after setting selection of an input element on a different webarea, the input element is still editable.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


AXValue: 1
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
var successfullyParsed = false;
</script>
</head>
<body id="body">

<div id="content">
<iframe id="iframe" onload="startTest();" src="data:text/html,<body><input type='text' name='foo' id='input' aria-label='label'></body>"></iframe>
</div>

<p id="description"></p>
<div id="console"></div>

<script>

description("This makes sure that in WK1 after setting selection of an input element on a different webarea, the input element is still editable.");

window.jsTestIsAsync = true;
function startTest() {

if (window.accessibilityController) {
accessibilityController.enableEnhancedAccessibility(true);
var input = accessibilityController.accessibleElementById("input");
var selectedRange = input.textMarkerRangeForElement(input);
var webArea = accessibilityController.rootElement.childAtIndex(0);

var iframe = document.getElementById("iframe");
iframe.contentDocument.getElementById("input").focus();
webArea.setSelectedVisibleTextRange(selectedRange);
eventSender.keyDown("1");
debug(input.stringValue);
finishJSTest();
}
}

successfullyParsed = true;
</script>

<script src="../../resources/js-test-post.js"></script>
</body>
</html>

@@ -1,3 +1,20 @@
2016-10-06 Nan Wang <n_wang@apple.com>

AX:[Mac] Unable to edit text input, textarea fields in iframe using VO naivgation
https://bugs.webkit.org/show_bug.cgi?id=162999

Reviewed by Chris Fleizach.

In WebKit1, the top web area setting the selection to an input element inside an iframe
will make the input field not editable. The issue is that when the web area and the input element
have different documents, the setSelection function in FrameSelection will set the selection on
the input's frame and cause the caret to disappear. I fixed it by not setting the selection in such case.

Test: accessibility/mac/wk1-set-selected-text-marker-range-input-element.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):

2016-10-05 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r206845.
@@ -2034,11 +2034,35 @@ IntRect AccessibilityRenderObject::boundsForRange(const RefPtr<Range> range) con

return boundsForRects(rect1, rect2, range);
}

bool AccessibilityRenderObject::isVisiblePositionRangeInDifferentDocument(const VisiblePositionRange& range) const
{
if (range.start.isNull() || range.end.isNull())
return false;

VisibleSelection newSelection = VisibleSelection(range.start, range.end);
if (Document* newSelectionDocument = newSelection.base().document()) {
if (RefPtr<Frame> newSelectionFrame = newSelectionDocument->frame()) {
Frame* frame = this->frame();
if (!frame || (newSelectionFrame != frame && newSelectionDocument != frame->document()))
return true;
}
}

return false;
}

void AccessibilityRenderObject::setSelectedVisiblePositionRange(const VisiblePositionRange& range) const
{
if (range.start.isNull() || range.end.isNull())
return;

// In WebKit1, when the top web area sets the selection to be an input element in an iframe, the caret will disappear.
// FrameSelection::setSelectionWithoutUpdatingAppearance is setting the selection on the new frame in this case, and causing this behavior.
if (isWebArea() && parentObject() && parentObject()->isAttachment()) {
if (isVisiblePositionRangeInDifferentDocument(range))
return;
}

// make selection and tell the document to use it. if it's zero length, then move to that position
if (range.start == range.end) {
@@ -173,6 +173,7 @@ class AccessibilityRenderObject : public AccessibilityNodeObject {
IntRect boundsForRange(const RefPtr<Range>) const override;
IntRect boundsForRects(LayoutRect&, LayoutRect&, RefPtr<Range>) const;
void setSelectedVisiblePositionRange(const VisiblePositionRange&) const override;
bool isVisiblePositionRangeInDifferentDocument(const VisiblePositionRange&) const;
bool ariaHasPopup() const override;

bool supportsARIADropping() const override;

0 comments on commit 5126ce9

Please sign in to comment.