Changeset 185974 in webkit


Ignore:
Timestamp:
Jun 25, 2015 6:00:21 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Bug 146300 AX: AccessibilityObject focus events that don't cause a selection
change can leave m_isSynchronizingSelection set to true
https://bugs.webkit.org/show_bug.cgi?id=146300

Patch by Doug Russell <d_russell@apple.com> on 2015-06-25
Reviewed by Chris Fleizach.

Added a clearTextSelectionIntent() convenience function to be used after any
event that can, but isn't guaranteed to result in a selection change. Matches
calls to setTextSelectionIntent() convenience function.
Added support for tests listening for focus change notifications.

Source/WebCore:

Test: platform/mac/accessibility/focus-setting-selection-syncronizing-not-clearing.html

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::clearTextSelectionIntent):
(WebCore::AccessibilityRenderObject::setSelectedTextRange):
(WebCore::AccessibilityRenderObject::setFocused):
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):

  • accessibility/mac/AXObjectCacheMac.mm:

(WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):

LayoutTests:

  • platform/mac/accessibility/focus-setting-selection-syncronizing-not-clearing-expected.txt: Added.
  • platform/mac/accessibility/focus-setting-selection-syncronizing-not-clearing.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185966 r185974  
     12015-06-25  Doug Russell  <d_russell@apple.com>
     2
     3        Bug 146300 AX: AccessibilityObject focus events that don't cause a selection
     4        change can leave m_isSynchronizingSelection set to true
     5        https://bugs.webkit.org/show_bug.cgi?id=146300
     6
     7        Reviewed by Chris Fleizach.
     8
     9        Added a clearTextSelectionIntent() convenience function to be used after any
     10        event that can, but isn't guaranteed to result in a selection change. Matches
     11        calls to setTextSelectionIntent() convenience function.
     12        Added support for tests listening for focus change notifications.
     13
     14        * platform/mac/accessibility/focus-setting-selection-syncronizing-not-clearing-expected.txt: Added.
     15        * platform/mac/accessibility/focus-setting-selection-syncronizing-not-clearing.html: Added.
     16
    1172015-06-25  Tim Horton  <timothy_horton@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r185973 r185974  
     12015-06-25  Doug Russell  <d_russell@apple.com>
     2
     3        Bug 146300 AX: AccessibilityObject focus events that don't cause a selection
     4        change can leave m_isSynchronizingSelection set to true
     5        https://bugs.webkit.org/show_bug.cgi?id=146300
     6
     7        Reviewed by Chris Fleizach.
     8
     9        Added a clearTextSelectionIntent() convenience function to be used after any
     10        event that can, but isn't guaranteed to result in a selection change. Matches
     11        calls to setTextSelectionIntent() convenience function.
     12        Added support for tests listening for focus change notifications.
     13
     14        Test: platform/mac/accessibility/focus-setting-selection-syncronizing-not-clearing.html
     15
     16        * accessibility/AccessibilityRenderObject.cpp:
     17        (WebCore::clearTextSelectionIntent):
     18        (WebCore::AccessibilityRenderObject::setSelectedTextRange):
     19        (WebCore::AccessibilityRenderObject::setFocused):
     20        (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
     21        * accessibility/mac/AXObjectCacheMac.mm:
     22        (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
     23
    1242015-06-25  Alex Christensen  <achristensen@webkit.org>
    225
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r185828 r185974  
    14991499}
    15001500
    1501 static void setTextSelectionIntent(const AccessibilityRenderObject& renderObject, AXTextStateChangeType type)
    1502 {
    1503     AXObjectCache* cache = renderObject.axObjectCache();
     1501static void setTextSelectionIntent(AXObjectCache* cache, AXTextStateChangeType type)
     1502{
    15041503    if (!cache)
    15051504        return;
     
    15091508}
    15101509
     1510static void clearTextSelectionIntent(AXObjectCache* cache)
     1511{
     1512    if (!cache)
     1513        return;
     1514    cache->setTextSelectionIntent(AXTextStateChangeIntent());
     1515    cache->setIsSynchronizingSelection(false);
     1516}
     1517
    15111518void AccessibilityRenderObject::setSelectedTextRange(const PlainTextRange& range)
    15121519{
    15131520    if (isNativeTextControl()) {
    1514         setTextSelectionIntent(*this, range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove);
     1521        setTextSelectionIntent(axObjectCache(), range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove);
    15151522        HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
    15161523        textControl.setSelectionRange(range.start, range.start + range.length);
     1524        clearTextSelectionIntent(axObjectCache());
    15171525        return;
    15181526    }
     
    15201528    Node* node = m_renderer->node();
    15211529    VisibleSelection newSelection(Position(node, range.start, Position::PositionIsOffsetInAnchor), Position(node, range.start + range.length, Position::PositionIsOffsetInAnchor), DOWNSTREAM);
    1522     setTextSelectionIntent(*this, range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove);
     1530    setTextSelectionIntent(axObjectCache(), range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove);
    15231531    m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions());
     1532    clearTextSelectionIntent(axObjectCache());
    15241533}
    15251534
     
    16751684        document->setFocusedElement(nullptr);
    16761685
    1677     setTextSelectionIntent(*this, AXTextStateChangeTypeSelectionMove);
     1686    setTextSelectionIntent(axObjectCache(), AXTextStateChangeTypeSelectionMove);
    16781687    downcast<Element>(*node).focus();
     1688    clearTextSelectionIntent(axObjectCache());
    16791689}
    16801690
     
    19902000    // make selection and tell the document to use it. if it's zero length, then move to that position
    19912001    if (range.start == range.end) {
    1992         setTextSelectionIntent(*this, AXTextStateChangeTypeSelectionMove);
     2002        setTextSelectionIntent(axObjectCache(), AXTextStateChangeTypeSelectionMove);
    19932003        m_renderer->frame().selection().moveTo(range.start, UserTriggered);
     2004        clearTextSelectionIntent(axObjectCache());
    19942005    }
    19952006    else {
    1996         setTextSelectionIntent(*this, AXTextStateChangeTypeSelectionExtend);
     2007        setTextSelectionIntent(axObjectCache(), AXTextStateChangeTypeSelectionExtend);
    19972008        VisibleSelection newSelection = VisibleSelection(range.start, range.end);
    19982009        m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions());
     2010        clearTextSelectionIntent(axObjectCache());
    19992011    }
    20002012}
  • trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm

    r183783 r185974  
    334334{
    335335    wkAccessibilityHandleFocusChanged();
     336    // AXFocusChanged is a test specific notification name and not something a real AT will be listening for
     337    if (UNLIKELY(axShouldRepostNotificationsForTests))
     338        [rootWebArea()->wrapper() accessibilityPostedNotification:@"AXFocusChanged" userInfo:nil];
    336339}
    337340
Note: See TracChangeset for help on using the changeset viewer.