Skip to content
  • aboxhall@chromium.org's avatar
    cf75b0ab
    Report correct line number for non-native editable text elements. · cf75b0ab
    aboxhall@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=71263
    
    Reviewed by Ryosuke Niwa.
    
    Source/WebCore:
    
    A non-native editable text element is an element with an ARIA role of "textbox", which is
    set on an element which behaves like an editable text element (such as a textarea, text
    input field or contenteditable text), but whose behaviour is controlled by the author rather
    than the browser.
    
    This change makes certain methods on Node, and related methods in htmlediting and
    visible_units, aware of the notion that an element may be editable only from the point of
    view of assistive technology (via the ARIA textbox role), via the EditableType enum added to
    EditingBoundary.h.
    
    This is so that AccessibilityObject::lineForPosition() can use previousLinePosition(), and
    AccessibilityRenderObject::indexForVisiblePosition() can use highestEditableRoot(), in a way
    that respects non-native editability.
    
    Test: accessibility/textbox-role-reports-line-number.html
    
    * accessibility/AXObjectCache.cpp:
    (WebCore::AXObjectCache::rootAXEditableElement): Returns the root element which is
    editable from the point of view of assistive technology, whether natively or otherwise.
    (WebCore::AXObjectCache::nodeIsTextControl): Whether the given node is considered an
    editable text element by assistive technology, natively or otherwise.
    * accessibility/AccessibilityObject.cpp:
    (WebCore::AccessibilityObject::lineForPosition): Modified to request the previous line
    position in an element which is editable to Accessibility.
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::indexForVisiblePosition): Modified to request the
    highest root element which is editable to Accessibility.
    * dom/Node.cpp:
    (WebCore::Node::rendererIsEditableToAccessibility): Whether this node is editable to
    Accessibility for the given EditableLevel.
    (WebCore::Node::rootEditableElement): Overloaded version of this method which takes an
    EditableType enum value indicating whether non-native editability is to be respected.
    * dom/Node.h:
    (WebCore::Node::rendererIsEditable): Overloaded version of this method which takes an
    EditableType enum value indicating whether non-native editability is to be respected.
    (WebCore::Node::rendererIsRichlyEditable):  Overloaded version of this method which takes
    an EditableType enum value indicating whether non-native editability is to be respected.
    * editing/EditingBoundary.h:
    * editing/htmlediting.cpp:
    (WebCore::highestEditableRoot): Added optional EditableType parameter.
    (WebCore::isEditablePosition): Added optional EditableType parameter.
    (WebCore::isRichlyEditablePosition): Added optional EditableType parameter.
    (WebCore::editableRootForPosition): Added optional EditableType parameter.
    * editing/htmlediting.h:
    * editing/visible_units.cpp:
    (WebCore::previousLeafWithSameEditability): Added optional EditableType parameter.
    (WebCore::previousLinePosition): Added optional EditableType parameter.
    (WebCore::nextLeafWithSameEditability): Added optional EditableType parameter.
    (WebCore::nextLinePosition): Added optional EditableType parameter.
    * editing/visible_units.h:
    
    LayoutTests:
    
    * accessibility/textbox-role-reports-line-number-expected.txt: Added.
    * accessibility/textbox-role-reports-line-number.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    cf75b0ab
    Report correct line number for non-native editable text elements.
    aboxhall@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=71263
    
    Reviewed by Ryosuke Niwa.
    
    Source/WebCore:
    
    A non-native editable text element is an element with an ARIA role of "textbox", which is
    set on an element which behaves like an editable text element (such as a textarea, text
    input field or contenteditable text), but whose behaviour is controlled by the author rather
    than the browser.
    
    This change makes certain methods on Node, and related methods in htmlediting and
    visible_units, aware of the notion that an element may be editable only from the point of
    view of assistive technology (via the ARIA textbox role), via the EditableType enum added to
    EditingBoundary.h.
    
    This is so that AccessibilityObject::lineForPosition() can use previousLinePosition(), and
    AccessibilityRenderObject::indexForVisiblePosition() can use highestEditableRoot(), in a way
    that respects non-native editability.
    
    Test: accessibility/textbox-role-reports-line-number.html
    
    * accessibility/AXObjectCache.cpp:
    (WebCore::AXObjectCache::rootAXEditableElement): Returns the root element which is
    editable from the point of view of assistive technology, whether natively or otherwise.
    (WebCore::AXObjectCache::nodeIsTextControl): Whether the given node is considered an
    editable text element by assistive technology, natively or otherwise.
    * accessibility/AccessibilityObject.cpp:
    (WebCore::AccessibilityObject::lineForPosition): Modified to request the previous line
    position in an element which is editable to Accessibility.
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::indexForVisiblePosition): Modified to request the
    highest root element which is editable to Accessibility.
    * dom/Node.cpp:
    (WebCore::Node::rendererIsEditableToAccessibility): Whether this node is editable to
    Accessibility for the given EditableLevel.
    (WebCore::Node::rootEditableElement): Overloaded version of this method which takes an
    EditableType enum value indicating whether non-native editability is to be respected.
    * dom/Node.h:
    (WebCore::Node::rendererIsEditable): Overloaded version of this method which takes an
    EditableType enum value indicating whether non-native editability is to be respected.
    (WebCore::Node::rendererIsRichlyEditable):  Overloaded version of this method which takes
    an EditableType enum value indicating whether non-native editability is to be respected.
    * editing/EditingBoundary.h:
    * editing/htmlediting.cpp:
    (WebCore::highestEditableRoot): Added optional EditableType parameter.
    (WebCore::isEditablePosition): Added optional EditableType parameter.
    (WebCore::isRichlyEditablePosition): Added optional EditableType parameter.
    (WebCore::editableRootForPosition): Added optional EditableType parameter.
    * editing/htmlediting.h:
    * editing/visible_units.cpp:
    (WebCore::previousLeafWithSameEditability): Added optional EditableType parameter.
    (WebCore::previousLinePosition): Added optional EditableType parameter.
    (WebCore::nextLeafWithSameEditability): Added optional EditableType parameter.
    (WebCore::nextLinePosition): Added optional EditableType parameter.
    * editing/visible_units.h:
    
    LayoutTests:
    
    * accessibility/textbox-role-reports-line-number-expected.txt: Added.
    * accessibility/textbox-role-reports-line-number.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Loading