Changeset 33520 in webkit


Ignore:
Timestamp:
May 16, 2008 10:26:23 AM (16 years ago)
Author:
Chris Fleizach
Message:

<rdar://problem/5710317> REGRESSION:Selecting ranges of text should be possible using the keyboard (15310)

Adds support to select text ranges when enhanced accessibility is turned on

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r33518 r33520  
     12008-05-16  Chris Fleizach  <cfleizach@apple.com>
     2
     3        Reviewed by Alice Liu
     4
     5        <rdar://problem/5710317> REGRESSION:Selecting ranges of text should be possible using the keyboard (15310)
     6
     7        * WebCore.base.exp:
     8        * editing/VisiblePosition.cpp:
     9        (WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
     10        (WebCore::VisiblePosition::rightVisuallyDistinctCandidate):
     11        * page/AXObjectCache.cpp:
     12        * page/AXObjectCache.h:
     13        (WebCore::AXObjectCache::enableEnhancedUserInterfaceAccessibility):
     14        (WebCore::AXObjectCache::accessibilityEnabled):
     15        (WebCore::AXObjectCache::accessibilityEnhancedUserInterfaceEnabled):
     16        * page/AccessibilityRenderObject.cpp:
     17        (WebCore::AccessibilityRenderObject::visiblePositionRange):
     18        (WebCore::AccessibilityRenderObject::doSetAXSelectedTextMarkerRange):
     19        (WebCore::AccessibilityRenderObject::addChildren):
     20        (WebCore::AccessibilityRenderObject::actionVerb):
     21        * page/EventHandler.cpp:
     22        (WebCore::EventHandler::handleKeyboardSelectionMovement):
     23        (WebCore::EventHandler::defaultKeyboardEventHandler):
     24        * page/EventHandler.h:
     25
    1262008-05-15  Ariya Hidayat  <ariya.hidayat@trolltech.com>
    227
  • trunk/WebCore/WebCore.base.exp

    r33504 r33520  
    139139__ZN7WebCore12TextIteratorC1EPKNS_5RangeEb
    140140__ZN7WebCore13AXObjectCache21gAccessibilityEnabledE
     141__ZN7WebCore13AXObjectCache42gAccessibilityEnhancedUserInterfaceEnabledE
    141142__ZN7WebCore13AXObjectCache3getEPNS_12RenderObjectE
    142143__ZN7WebCore13HitTestResultC1ERKS0_
  • trunk/WebCore/editing/VisiblePosition.cpp

    r32605 r33520  
    106106{
    107107    Position p = m_deepPosition;
     108    if (!p.node())
     109        return Position();
     110
    108111    Position downstreamStart = p.downstream();
    109 
    110112    TextDirection primaryDirection = LTR;
    111113    for (RenderObject* r = p.node()->renderer(); r; r = r->parent()) {
     
    245247{
    246248    Position p = m_deepPosition;
     249    if (!p.node())
     250        return Position();
     251
    247252    Position downstreamStart = p.downstream();
    248 
    249253    TextDirection primaryDirection = LTR;
    250254    for (RenderObject* r = p.node()->renderer(); r; r = r->parent()) {
  • trunk/WebCore/page/AXObjectCache.cpp

    r33514 r33520  
    4040
    4141bool AXObjectCache::gAccessibilityEnabled = false;
     42bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false;
    4243
    4344AXObjectCache::~AXObjectCache()
  • trunk/WebCore/page/AXObjectCache.h

    r33510 r33520  
    7878        void handleFocusedUIElementChanged();
    7979        static void enableAccessibility() { gAccessibilityEnabled = true; }
     80        static void enableEnhancedUserInterfaceAccessibility() { gAccessibilityEnhancedUserInterfaceEnabled = true; }
     81       
    8082        static bool accessibilityEnabled() { return gAccessibilityEnabled; }
    81        
     83        static bool accessibilityEnhancedUserInterfaceEnabled() { return gAccessibilityEnhancedUserInterfaceEnabled; }
     84
    8285        void removeAXID(AccessibilityObject*);
    8386        bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); }
     
    8790        HashMap<RenderObject*, AXID> m_renderObjectMapping;
    8891        static bool gAccessibilityEnabled;
     92        static bool gAccessibilityEnhancedUserInterfaceEnabled;
     93       
    8994        HashSet<AXID> m_idsInUse;
    9095       
  • trunk/WebCore/page/AccessibilityRenderObject.cpp

    r33510 r33520  
    12121212    // construct VisiblePositions for start and end
    12131213    Node* node = m_renderer->element();
     1214    if (!node)
     1215        return VisiblePositionRange();
     1216   
    12141217    VisiblePosition startPos = VisiblePosition(node, 0, VP_DEFAULT_AFFINITY);
    12151218    VisiblePosition endPos = VisiblePosition(node, maxDeepOffset(node), VP_DEFAULT_AFFINITY);
     
    13461349        return;
    13471350   
    1348     // make selection and tell the document to use it
    1349     Selection newSelection = Selection(textMarkerRange.start, textMarkerRange.end);
    1350     m_renderer->document()->frame()->selectionController()->setSelection(newSelection);
     1351    // make selection and tell the document to use it. if it's zero length, then move to that position
     1352    if (textMarkerRange.start == textMarkerRange.end) {
     1353        m_renderer->document()->frame()->selectionController()->moveTo(textMarkerRange.start, true);
     1354    }
     1355    else {
     1356        Selection newSelection = Selection(textMarkerRange.start, textMarkerRange.end);
     1357        m_renderer->document()->frame()->selectionController()->setSelection(newSelection);
     1358    }   
    13511359}
    13521360
     
    18861894    for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling()) {
    18871895        if (obj->accessibilityIsIgnored()) {
    1888             if (!m_haveChildren)
     1896            if (!obj->hasChildren())
    18891897                obj->addChildren();
    18901898            Vector<RefPtr<AccessibilityObject> >children = obj->children();
     
    19922000}   
    19932001   
    1994     const String& AccessibilityRenderObject::actionVerb() const
     2002const String& AccessibilityRenderObject::actionVerb() const
    19952003{
    19962004    // FIXME: Need to add verbs for select elements.
  • trunk/WebCore/page/EventHandler.cpp

    r33503 r33520  
    2828#include "EventHandler.h"
    2929
     30#include "AXObjectCache.h"
    3031#include "CachedImage.h"
    3132#include "ChromeClient.h"
     
    15791580}
    15801581
     1582void EventHandler::handleKeyboardSelectionMovement(KeyboardEvent* event)
     1583{
     1584    if (!event)
     1585        return;
     1586   
     1587    String key = event->keyIdentifier();           
     1588    bool isShifted = event->getModifierState("Shift");
     1589    bool isOptioned = event->getModifierState("Alt");
     1590   
     1591    if (key == "Up") {
     1592        m_frame->selectionController()->modify((isShifted) ? SelectionController::EXTEND : SelectionController::MOVE, SelectionController::BACKWARD, LineGranularity, true);
     1593        event->setDefaultHandled();
     1594    }
     1595    else if (key == "Down") {
     1596        m_frame->selectionController()->modify((isShifted) ? SelectionController::EXTEND : SelectionController::MOVE, SelectionController::FORWARD, LineGranularity, true);
     1597        event->setDefaultHandled();
     1598    }
     1599    else if (key == "Left") {
     1600        m_frame->selectionController()->modify((isShifted) ? SelectionController::EXTEND : SelectionController::MOVE, SelectionController::LEFT, (isOptioned) ? WordGranularity : CharacterGranularity, true);
     1601        event->setDefaultHandled();
     1602    }
     1603    else if (key == "Right") {
     1604        m_frame->selectionController()->modify((isShifted) ? SelectionController::EXTEND : SelectionController::MOVE, SelectionController::RIGHT, (isOptioned) ? WordGranularity : CharacterGranularity, true);
     1605        event->setDefaultHandled();
     1606    }   
     1607}
     1608   
    15811609void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
    15821610{
     
    15871615        if (event->keyIdentifier() == "U+0009")
    15881616            defaultTabEventHandler(event);
     1617
     1618       // provides KB navigation and selection for enhanced accessibility users
     1619       if (AXObjectCache::accessibilityEnhancedUserInterfaceEnabled())
     1620           handleKeyboardSelectionMovement(event);       
    15891621   }
    15901622   if (event->type() == keypressEvent) {
  • trunk/WebCore/page/EventHandler.h

    r33503 r33520  
    203203    bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
    204204
     205    void handleKeyboardSelectionMovement(KeyboardEvent*);
     206   
    205207    Cursor selectCursor(const MouseEventWithHitTestResults&, PlatformScrollbar*);
    206208
  • trunk/WebKit/mac/ChangeLog

    r33506 r33520  
     12008-05-16  Chris Fleizach  <cfleizach@apple.com>
     2
     3        Reviewed by Alice Liu
     4
     5        <rdar://problem/5710317> REGRESSION:Selecting ranges of text should be possible using the keyboard (15310)
     6
     7        * WebView/WebFrame.mm:
     8        (-[WebFrame _accessibilityTree]):
     9
    1102008-05-15  Stephanie Lewis  <slewis@apple.com>
    211       
  • trunk/WebKit/mac/WebView/WebFrame.mm

    r33503 r33520  
    121121NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
    122122
     123// FIXME: Remove when this key becomes publicly defined
     124NSString *NSAccessibilityEnhancedUserInterfaceAttribute = @"AXEnhancedUserInterface";
     125
    123126@implementation WebFramePrivate
    124127
     
    670673- (id)_accessibilityTree
    671674{
    672     AXObjectCache::enableAccessibility();
     675    if (!AXObjectCache::accessibilityEnabled()) {
     676        AXObjectCache::enableAccessibility();
     677        if ([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue])
     678            AXObjectCache::enableEnhancedUserInterfaceAccessibility();
     679    }
     680
    673681    if (!_private->coreFrame || !_private->coreFrame->document())
    674682        return nil;
Note: See TracChangeset for help on using the changeset viewer.