Changeset 15965 in webkit


Ignore:
Timestamp:
Aug 22, 2006, 5:47:26 AM (18 years ago)
Author:
harrison
Message:

Reviewed by Maciej.

<rdar://problem/4407336> Some non-text elements return AXTextMarkerRangeForUIElement with equal start and end marker

  • bridge/mac/WebCoreAXObject.mm: (-[WebCoreAXObject textMarkerRange]): Use 0 and maxDeepOffset(), instead of caretMinOffset() and caretMaxRenderedOffset(). Check for VisiblePositions being equal. If so, adjust end one to its next(). That happens with, e.g., buttons.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r15964 r15965  
     12006-08-22  David Harrison  <harrison@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        <rdar://problem/4407336> Some non-text elements return AXTextMarkerRangeForUIElement with equal start and end marker
     6
     7        * bridge/mac/WebCoreAXObject.mm:
     8        (-[WebCoreAXObject textMarkerRange]):
     9        Use 0 and maxDeepOffset(), instead of caretMinOffset() and caretMaxRenderedOffset().
     10        Check for VisiblePositions being equal.  If so, adjust end one to its next().
     11        That happens with, e.g., buttons.
     12
    1132006-08-22  Rob Buis  <buis@kde.org>
    214
  • trunk/WebCore/bridge/mac/WebCoreAXObject.mm

    r15959 r15965  
    3434#import "HTMLAreaElement.h"
    3535#import "HTMLCollection.h"
     36#import "htmlediting.h"
    3637#import "HTMLFrameElement.h"
    3738#import "HTMLInputElement.h"
     
    787788    if (!m_renderer)
    788789        return nil;
    789        
    790     WebCoreTextMarker* startTextMarker = [self textMarkerForVisiblePosition: VisiblePosition(m_renderer->element(), m_renderer->caretMinOffset(), VP_DEFAULT_AFFINITY)];
    791     WebCoreTextMarker* endTextMarker   = [self textMarkerForVisiblePosition: VisiblePosition(m_renderer->element(), m_renderer->caretMaxRenderedOffset(), VP_DEFAULT_AFFINITY)];
     790   
     791    // construct VisiblePositions for start and end
     792    Node* node = m_renderer->element();
     793    VisiblePosition visiblePos1 = VisiblePosition(node, 0, VP_DEFAULT_AFFINITY);
     794    VisiblePosition visiblePos2 = VisiblePosition(node, maxDeepOffset(node), VP_DEFAULT_AFFINITY);
     795   
     796    // the VisiblePositions are equal for nodes like buttons, so adjust for that
     797    if (visiblePos1 == visiblePos2) {
     798        visiblePos2 = visiblePos2.next();
     799        if (visiblePos2.isNull())
     800            visiblePos2 = visiblePos1;
     801    }
     802   
     803    WebCoreTextMarker* startTextMarker = [self textMarkerForVisiblePosition: visiblePos1];
     804    WebCoreTextMarker* endTextMarker   = [self textMarkerForVisiblePosition: visiblePos2];
    792805    return [self textMarkerRangeFromMarkers: startTextMarker andEndMarker:endTextMarker];
    793806}
Note: See TracChangeset for help on using the changeset viewer.