Title: [206854] trunk
Revision
206854
Author
n_w...@apple.com
Date
2016-10-06 01:03:43 -0700 (Thu, 06 Oct 2016)

Log Message

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.

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206853 => 206854)


--- trunk/LayoutTests/ChangeLog	2016-10-06 07:44:23 UTC (rev 206853)
+++ trunk/LayoutTests/ChangeLog	2016-10-06 08:03:43 UTC (rev 206854)
@@ -1,3 +1,13 @@
+2016-10-06  Nan Wang  <n_w...@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....@gmail.com>
 
         [JSC] Add @throwXXXError bytecode intrinsic

Added: trunk/LayoutTests/accessibility/mac/wk1-set-selected-text-marker-range-input-element-expected.txt (0 => 206854)


--- trunk/LayoutTests/accessibility/mac/wk1-set-selected-text-marker-range-input-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/wk1-set-selected-text-marker-range-input-element-expected.txt	2016-10-06 08:03:43 UTC (rev 206854)
@@ -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
+

Added: trunk/LayoutTests/accessibility/mac/wk1-set-selected-text-marker-range-input-element.html (0 => 206854)


--- trunk/LayoutTests/accessibility/mac/wk1-set-selected-text-marker-range-input-element.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/wk1-set-selected-text-marker-range-input-element.html	2016-10-06 08:03:43 UTC (rev 206854)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+var successfullyParsed = false;
+</script>
+</head>
+<body id="body">
+
+<div id="content">
+<iframe id="iframe" _onload_="startTest();" src="" 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=""
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (206853 => 206854)


--- trunk/Source/WebCore/ChangeLog	2016-10-06 07:44:23 UTC (rev 206853)
+++ trunk/Source/WebCore/ChangeLog	2016-10-06 08:03:43 UTC (rev 206854)
@@ -1,3 +1,20 @@
+2016-10-06  Nan Wang  <n_w...@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-qu...@webkit.org>
 
         Unreviewed, rolling out r206845.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (206853 => 206854)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-10-06 07:44:23 UTC (rev 206853)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-10-06 08:03:43 UTC (rev 206854)
@@ -2034,11 +2034,35 @@
     
     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) {

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (206853 => 206854)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2016-10-06 07:44:23 UTC (rev 206853)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2016-10-06 08:03:43 UTC (rev 206854)
@@ -173,6 +173,7 @@
     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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to