Changeset 200508 in webkit


Ignore:
Timestamp:
May 6, 2016 12:27:22 AM (8 years ago)
Author:
n_wang@apple.com
Message:

AX: String for document range is empty if end visible position anchors to a ignored replaced node
https://bugs.webkit.org/show_bug.cgi?id=157403

Reviewed by Chris Fleizach.

Source/WebCore:

The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in
such case.

Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html

  • accessibility/AXObjectCache.cpp:

(WebCore::characterOffsetsInOrder):
(WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
(WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):

LayoutTests:

  • accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt: Added.
  • accessibility/mac/text-marker-string-for-document-end-replaced-node.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200501 r200508  
     12016-05-06  Nan Wang  <n_wang@apple.com>
     2
     3        AX: String for document range is empty if end visible position anchors to a ignored replaced node
     4        https://bugs.webkit.org/show_bug.cgi?id=157403
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt: Added.
     9        * accessibility/mac/text-marker-string-for-document-end-replaced-node.html: Added.
     10
    1112016-05-05  Dean Jackson  <dino@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r200507 r200508  
     12016-05-06  Nan Wang  <n_wang@apple.com>
     2
     3        AX: String for document range is empty if end visible position anchors to a ignored replaced node
     4        https://bugs.webkit.org/show_bug.cgi?id=157403
     5
     6        Reviewed by Chris Fleizach.
     7
     8        The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
     9        to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in
     10        such case.
     11
     12        Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html
     13
     14        * accessibility/AXObjectCache.cpp:
     15        (WebCore::characterOffsetsInOrder):
     16        (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
     17        (WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):
     18
    1192016-05-05  David Kilzer  <ddkilzer@apple.com>
    220
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r200258 r200508  
    16561656    Node* node1 = characterOffset1.node;
    16571657    Node* node2 = characterOffset2.node;
    1658     if (!node1->offsetInCharacters() && !isReplacedNodeOrBR(node1))
     1658    if (!node1->offsetInCharacters() && !isReplacedNodeOrBR(node1) && node1->hasChildNodes())
    16591659        node1 = node1->traverseToChildAt(characterOffset1.offset);
    1660     if (!node2->offsetInCharacters() && !isReplacedNodeOrBR(node2))
     1660    if (!node2->offsetInCharacters() && !isReplacedNodeOrBR(node2) && node2->hasChildNodes())
    16611661        node2 = node2->traverseToChildAt(characterOffset2.offset);
    16621662   
     
    19981998    }
    19991999   
    2000     return traverseToOffsetInRange(rangeForNodeContents(obj->node()), characterOffset);
     2000    // Sometimes when the node is a replaced node and is ignored in accessibility, we get a wrong CharacterOffset from it.
     2001    CharacterOffset result = traverseToOffsetInRange(rangeForNodeContents(obj->node()), characterOffset);
     2002    if  (result.remainingOffset > 0 && !result.isNull() && isRendererReplacedElement(result.node->renderer()))
     2003        result.offset += result.remainingOffset;
     2004    return result;
    20012005}
    20022006
Note: See TracChangeset for help on using the changeset viewer.