Changeset 206854 in webkit


Ignore:
Timestamp:
Oct 6, 2016 1:03:43 AM (8 years ago)
Author:
n_wang@apple.com
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.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206853 r206854  
     12016-10-06  Nan Wang  <n_wang@apple.com>
     2
     3        AX:[Mac] Unable to edit text input, textarea fields in iframe using VO naivgation
     4        https://bugs.webkit.org/show_bug.cgi?id=162999
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/mac/wk1-set-selected-text-marker-range-input-element-expected.txt: Added.
     9        * accessibility/mac/wk1-set-selected-text-marker-range-input-element.html: Added.
     10
    1112016-10-05  Yusuke Suzuki  <utatane.tea@gmail.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r206852 r206854  
     12016-10-06  Nan Wang  <n_wang@apple.com>
     2
     3        AX:[Mac] Unable to edit text input, textarea fields in iframe using VO naivgation
     4        https://bugs.webkit.org/show_bug.cgi?id=162999
     5
     6        Reviewed by Chris Fleizach.
     7
     8        In WebKit1, the top web area setting the selection to an input element inside an iframe
     9        will make the input field not editable. The issue is that when the web area and the input element
     10        have different documents, the setSelection function in FrameSelection will set the selection on
     11        the input's frame and cause the caret to disappear. I fixed it by not setting the selection in such case.
     12
     13        Test: accessibility/mac/wk1-set-selected-text-marker-range-input-element.html
     14
     15        * accessibility/AccessibilityRenderObject.cpp:
     16        (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
     17
    1182016-10-05  Commit Queue  <commit-queue@webkit.org>
    219
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r206581 r206854  
    20352035    return boundsForRects(rect1, rect2, range);
    20362036}
     2037
     2038bool AccessibilityRenderObject::isVisiblePositionRangeInDifferentDocument(const VisiblePositionRange& range) const
     2039{
     2040    if (range.start.isNull() || range.end.isNull())
     2041        return false;
     2042   
     2043    VisibleSelection newSelection = VisibleSelection(range.start, range.end);
     2044    if (Document* newSelectionDocument = newSelection.base().document()) {
     2045        if (RefPtr<Frame> newSelectionFrame = newSelectionDocument->frame()) {
     2046            Frame* frame = this->frame();
     2047            if (!frame || (newSelectionFrame != frame && newSelectionDocument != frame->document()))
     2048                return true;
     2049        }
     2050    }
     2051   
     2052    return false;
     2053}
    20372054   
    20382055void AccessibilityRenderObject::setSelectedVisiblePositionRange(const VisiblePositionRange& range) const
     
    20402057    if (range.start.isNull() || range.end.isNull())
    20412058        return;
     2059   
     2060    // In WebKit1, when the top web area sets the selection to be an input element in an iframe, the caret will disappear.
     2061    // FrameSelection::setSelectionWithoutUpdatingAppearance is setting the selection on the new frame in this case, and causing this behavior.
     2062    if (isWebArea() && parentObject() && parentObject()->isAttachment()) {
     2063        if (isVisiblePositionRangeInDifferentDocument(range))
     2064            return;
     2065    }
    20422066
    20432067    // make selection and tell the document to use it. if it's zero length, then move to that position
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h

    r202961 r206854  
    174174    IntRect boundsForRects(LayoutRect&, LayoutRect&, RefPtr<Range>) const;
    175175    void setSelectedVisiblePositionRange(const VisiblePositionRange&) const override;
     176    bool isVisiblePositionRangeInDifferentDocument(const VisiblePositionRange&) const;
    176177    bool ariaHasPopup() const override;
    177178
Note: See TracChangeset for help on using the changeset viewer.