Title: [186256] trunk
Revision
186256
Author
commit-qu...@webkit.org
Date
2015-07-02 20:34:36 -0700 (Thu, 02 Jul 2015)

Log Message

AX: Selection change as a result of focusing an element should include that
information in the intent
https://bugs.webkit.org/show_bug.cgi?id=146533

Patch by Doug Russell <d_russ...@apple.com> on 2015-07-02
Reviewed by Chris Fleizach.

Added focusChange flag to AXTextStateChangeIntent.
Added intent support to selection logic called by Element::updateFocusAppearance().
Added NSAccessibilityTextSelectionChangedFocus to mac notifications.

Source/WebCore:

Test: platform/mac/accessibility/selection-notification-focus-change.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::postTextStateChangeNotification):
* accessibility/AXTextStateChangeIntent.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::setTextSelectionIntent):
(WebCore::AccessibilityRenderObject::setFocused):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
* dom/Element.cpp:
(WebCore::Element::updateFocusAppearance):
* dom/Element.h:
(WebCore::Element::defaultFocusTextStateChangeIntent):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelectionByMouseIfDifferent):
(WebCore::FrameSelection::selectAll):
* editing/FrameSelection.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateFocusAppearance):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::updateFocusAppearance):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::select):
(WebCore::HTMLTextFormControlElement::setSelectionRange):
(WebCore::HTMLTextFormControlElement::restoreCachedSelection):
* html/HTMLTextFormControlElement.h:
* page/EventHandler.cpp:
(WebCore::setInitialKeyboardSelection):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):

LayoutTests:

* platform/mac/accessibility/selection-notification-focus-change-expected.txt: Added.
* platform/mac/accessibility/selection-notification-focus-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (186255 => 186256)


--- trunk/LayoutTests/ChangeLog	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/LayoutTests/ChangeLog	2015-07-03 03:34:36 UTC (rev 186256)
@@ -1,3 +1,18 @@
+2015-07-02  Doug Russell  <d_russ...@apple.com>
+
+        AX: Selection change as a result of focusing an element should include that 
+        information in the intent
+        https://bugs.webkit.org/show_bug.cgi?id=146533
+
+        Reviewed by Chris Fleizach.
+
+        Added focusChange flag to AXTextStateChangeIntent.
+        Added intent support to selection logic called by Element::updateFocusAppearance().
+        Added NSAccessibilityTextSelectionChangedFocus to mac notifications.
+
+        * platform/mac/accessibility/selection-notification-focus-change-expected.txt: Added.
+        * platform/mac/accessibility/selection-notification-focus-change.html: Added.
+
 2015-07-02  Saam barati  <saambara...@gmail.com>
 
         Rename "Deconstruction" to "Destructuring" throughout JSC

Added: trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt (0 => 186256)


--- trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt	2015-07-03 03:34:36 UTC (rev 186256)
@@ -0,0 +1,18 @@
+
+ 1
+ 2
+This tests that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS addedNotification is true
+PASS axTextFocusChangeOne is true
+PASS axTextFocusChangeTwo is true
+PASS accessibilityController.accessibleElementById("1").isFocusable is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS axTextFocusChangeThree is true
+PASS axTextFocusChangeFour is true
+

Added: trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html (0 => 186256)


--- trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html	2015-07-03 03:34:36 UTC (rev 186256)
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body id="body">
+        <fieldset>
+            <div>
+                <input id="1">
+                    <label for=""
+                    </div>
+            <div>
+                <input id="2">
+                    <label for=""
+                    </div>
+        </fieldset>
+        <p id="description"></p>
+        <div id="console"></div>
+        <div id="notifications"></div>
+        <script>
+            description("This tests that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag.");
+
+            var webArea = 0;
+            var axTextFocusChangeOne = 0;
+            var axTextFocusChangeTwo = 0;
+            var axTextFocusChangeThree = 0;
+            var axTextFocusChangeFour = 0;
+            var selectCount = 0;
+            var focusCount = 0;
+            // Notification ordering:
+            // The first tab will result in 2 selection change notifications and a focus notification          selectCount=2, focusCount=1
+            // takeFocus() will result in a focus notification                                                 selectCount=2, focusCount=2
+            // The second tab will result in another 2 selection change notifications and a focus notification selectCount=1, focusCount=3
+            // (The 2 selection change notifications per tab is caused by caret browsing being enabled)
+            function notificationCallback(notification, userInfo) {
+                if (notification == "AXSelectedTextChanged") {
+                    selectCount++;
+                    if (selectCount == 1) {
+                        axTextFocusChangeOne = userInfo["AXTextSelectionChangedFocus"];
+                        shouldBe("axTextFocusChangeOne", "true");
+                    } else if (selectCount == 2) {
+                        axTextFocusChangeTwo = userInfo["AXTextSelectionChangedFocus"];
+                        shouldBe("axTextFocusChangeTwo", "true");
+
+                        shouldBe("accessibilityController.accessibleElementById(\"1\").isFocusable", "true");
+                        accessibilityController.accessibleElementById("1").takeFocus();
+                    } else if (selectCount == 3) {
+                        axTextFocusChangeThree = userInfo["AXTextSelectionChangedFocus"];
+                        shouldBe("axTextFocusChangeThree", "true");
+                    } else if (selectCount == 4) {
+                        axTextFocusChangeFour = userInfo["AXTextSelectionChangedFocus"];
+                        shouldBe("axTextFocusChangeFour", "true");
+                    }
+                } else if (notification == "AXFocusChanged") {
+                    focusCount++;
+                    if (focusCount == 2) {
+                        eventSender.scheduleAsynchronousKeyDown("\t");
+                    }
+                }
+                if (selectCount == 4 && focusCount == 3) {
+                    webArea.removeNotificationListener();
+                    testRunner.notifyDone();
+                }
+            }
+
+            if (window.accessibilityController) {
+                testRunner.waitUntilDone();
+                testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+
+                accessibilityController.enableEnhancedAccessibility(true);
+                webArea = accessibilityController.rootElement.childAtIndex(0);
+                webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", true)
+
+                var addedNotification = webArea.addNotificationListener(notificationCallback);
+                shouldBe("addedNotification", "true");
+
+                eventSender.keyDown("\t");
+            }
+            </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (186255 => 186256)


--- trunk/Source/WebCore/ChangeLog	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/ChangeLog	2015-07-03 03:34:36 UTC (rev 186256)
@@ -1,3 +1,48 @@
+2015-07-02  Doug Russell  <d_russ...@apple.com>
+
+        AX: Selection change as a result of focusing an element should include that 
+        information in the intent
+        https://bugs.webkit.org/show_bug.cgi?id=146533
+
+        Reviewed by Chris Fleizach.
+
+        Added focusChange flag to AXTextStateChangeIntent.
+        Added intent support to selection logic called by Element::updateFocusAppearance().
+        Added NSAccessibilityTextSelectionChangedFocus to mac notifications.
+
+        Test: platform/mac/accessibility/selection-notification-focus-change.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::postTextStateChangeNotification):
+        * accessibility/AXTextStateChangeIntent.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::setTextSelectionIntent):
+        (WebCore::AccessibilityRenderObject::setFocused):
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
+        * dom/Element.cpp:
+        (WebCore::Element::updateFocusAppearance):
+        * dom/Element.h:
+        (WebCore::Element::defaultFocusTextStateChangeIntent):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::moveWithoutValidationTo):
+        (WebCore::FrameSelection::setSelectionByMouseIfDifferent):
+        (WebCore::FrameSelection::selectAll):
+        * editing/FrameSelection.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateFocusAppearance):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::updateFocusAppearance):
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::select):
+        (WebCore::HTMLTextFormControlElement::setSelectionRange):
+        (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
+        * html/HTMLTextFormControlElement.h:
+        * page/EventHandler.cpp:
+        (WebCore::setInitialKeyboardSelection):
+        * page/FocusController.cpp:
+        (WebCore::FocusController::advanceFocusInDocumentOrder):
+
 2015-07-02  Przemek Piorkowski  <piorkowskiprzemys...@gmail.com>
 
         [EFL] test_ewk2_application_cache_manager has been failed since r185527

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (186255 => 186256)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -1053,7 +1053,8 @@
             object = observableObject;
     }
 
-    postTextStateChangePlatformNotification(object, (intent.type == AXTextStateChangeTypeUnknown || m_isSynchronizingSelection) ? m_textSelectionIntent : intent, selection);
+    const AXTextStateChangeIntent& newIntent = (intent.type == AXTextStateChangeTypeUnknown || (m_isSynchronizingSelection && m_textSelectionIntent.type != AXTextStateChangeTypeUnknown)) ? m_textSelectionIntent : intent;
+    postTextStateChangePlatformNotification(object, newIntent, selection);
 #else
     UNUSED_PARAM(object);
     UNUSED_PARAM(intent);

Modified: trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h (186255 => 186256)


--- trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h	2015-07-03 03:34:36 UTC (rev 186256)
@@ -70,6 +70,7 @@
 struct AXTextSelection {
     AXTextSelectionDirection direction;
     AXTextSelectionGranularity granularity;
+    bool focusChange;
 };
 
 struct AXTextStateChangeIntent {

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (186255 => 186256)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -1502,7 +1502,7 @@
 {
     if (!cache)
         return;
-    AXTextStateChangeIntent intent(type, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
+    AXTextStateChangeIntent intent(type, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false });
     cache->setTextSelectionIntent(intent);
     cache->setIsSynchronizingSelection(true);
 }
@@ -1683,9 +1683,9 @@
     if (document->focusedElement() == node)
         document->setFocusedElement(nullptr);
 
-    setTextSelectionIntent(axObjectCache(), AXTextStateChangeTypeSelectionMove);
+    axObjectCache()->setIsSynchronizingSelection(true);
     downcast<Element>(*node).focus();
-    clearTextSelectionIntent(axObjectCache());
+    axObjectCache()->setIsSynchronizingSelection(false);
 }
 
 void AccessibilityRenderObject::setSelectedRows(AccessibilityChildrenVector& selectedRows)

Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (186255 => 186256)


--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2015-07-03 03:34:36 UTC (rev 186256)
@@ -60,6 +60,10 @@
 #define NSAccessibilityTextSelectionGranularity @"AXTextSelectionGranularity"
 #endif
 
+#ifndef NSAccessibilityTextSelectionChangedFocus
+#define NSAccessibilityTextSelectionChangedFocus @"AXTextSelectionChangedFocus"
+#endif
+
 #ifndef NSAccessibilityTextEditType
 #define NSAccessibilityTextEditType @"AXTextEditType"
 #endif
@@ -249,6 +253,8 @@
         case AXTextStateChangeTypeEdit:
             break;
         }
+        if (intent.selection.focusChange)
+            [userInfo setObject:[NSNumber numberWithBool:intent.selection.focusChange] forKey:NSAccessibilityTextSelectionChangedFocus];
     }
     if (!selection.isNone()) {
         if (id textMarkerRange = [object->wrapper() textMarkerRangeFromVisiblePositions:selection.visibleStart() endPosition:selection.visibleEnd()])

Modified: trunk/Source/WebCore/dom/Element.cpp (186255 => 186256)


--- trunk/Source/WebCore/dom/Element.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/dom/Element.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -2199,7 +2199,7 @@
         VisibleSelection newSelection = VisibleSelection(firstPositionInOrBeforeNode(this), DOWNSTREAM);
         
         if (frame->selection().shouldChangeSelection(newSelection)) {
-            frame->selection().setSelection(newSelection);
+            frame->selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), Element::defaultFocusTextStateChangeIntent());
             frame->selection().revealSelection();
         }
     } else if (renderer() && !renderer()->isWidget())

Modified: trunk/Source/WebCore/dom/Element.h (186255 => 186256)


--- trunk/Source/WebCore/dom/Element.h	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/dom/Element.h	2015-07-03 03:34:36 UTC (rev 186256)
@@ -25,6 +25,7 @@
 #ifndef Element_h
 #define Element_h
 
+#include "AXTextStateChangeIntent.h"
 #include "Document.h"
 #include "ElementData.h"
 #include "HTMLNames.h"
@@ -321,6 +322,7 @@
     virtual const AtomicString& imageSourceURL() const;
     virtual String target() const { return String(); }
 
+    static AXTextStateChangeIntent defaultFocusTextStateChangeIntent() { return AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, true }); }
     void updateFocusAppearanceAfterAttachIfNeeded();
     virtual void focus(bool restorePreviousSelection = true, FocusDirection = FocusDirectionNone);
     virtual void updateFocusAppearance(bool restorePreviousSelection);

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (186255 => 186256)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -166,13 +166,13 @@
     setSelection(VisibleSelection(base, extent, affinity, selectionHasDirection), defaultSetSelectionOptions(userTriggered));
 }
 
-void FrameSelection::moveWithoutValidationTo(const Position& base, const Position& extent, bool selectionHasDirection, bool shouldSetFocus)
+void FrameSelection::moveWithoutValidationTo(const Position& base, const Position& extent, bool selectionHasDirection, bool shouldSetFocus, const AXTextStateChangeIntent& intent)
 {
     VisibleSelection newSelection;
     newSelection.setWithoutValidation(base, extent);
     newSelection.setIsDirectional(selectionHasDirection);
-    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
-    setSelection(newSelection, defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus), intent);
+    AXTextStateChangeIntent newIntent = intent.type == AXTextStateChangeTypeUnknown ? AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false }) : intent;
+    setSelection(newSelection, defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus), newIntent);
 }
 
 void DragCaretController::setCaretPosition(const VisiblePosition& position)
@@ -259,7 +259,7 @@
     
     AXTextStateChangeIntent intent;
     if (AXObjectCache::accessibilityEnabled() && newSelection.isCaret())
-        intent = AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
+        intent = AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false });
     else
         intent = AXTextStateChangeIntent();
     setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent, AlignCursorOnScrollIfNeeded, granularity);
@@ -1792,7 +1792,7 @@
     VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(root.get()));
 
     if (shouldChangeSelection(newSelection)) {
-        AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionExtend, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityAll });
+        AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionExtend, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityAll, false });
         setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent);
     }
 }

Modified: trunk/Source/WebCore/editing/FrameSelection.h (186255 => 186256)


--- trunk/Source/WebCore/editing/FrameSelection.h	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2015-07-03 03:34:36 UTC (rev 186256)
@@ -142,7 +142,7 @@
     WEBCORE_EXPORT void moveTo(const VisiblePosition&, const VisiblePosition&, EUserTriggered = NotUserTriggered);
     void moveTo(const Position&, EAffinity, EUserTriggered = NotUserTriggered);
     void moveTo(const Position&, const Position&, EAffinity, EUserTriggered = NotUserTriggered);
-    void moveWithoutValidationTo(const Position&, const Position&, bool selectionHasDirection, bool shouldSetFocus);
+    void moveWithoutValidationTo(const Position&, const Position&, bool selectionHasDirection, bool shouldSetFocus, const AXTextStateChangeIntent& = AXTextStateChangeIntent());
 
     const VisibleSelection& selection() const { return m_selection; }
     WEBCORE_EXPORT void setSelection(const VisibleSelection&, SetSelectionOptions = defaultSetSelectionOptions(), AXTextStateChangeIntent = AXTextStateChangeIntent(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (186255 => 186256)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -407,7 +407,7 @@
 {
     if (isTextField()) {
         if (!restorePreviousSelection || !hasCachedSelection())
-            select();
+            select(Element::defaultFocusTextStateChangeIntent());
         else
             restoreCachedSelection();
         if (document().frame())

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (186255 => 186256)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -257,9 +257,9 @@
         // If this is the first focus, set a caret at the beginning of the text.  
         // This matches some browsers' behavior; see bug 11746 Comment #15.
         // http://bugs.webkit.org/show_bug.cgi?id=11746#c15
-        setSelectionRange(0, 0);
+        setSelectionRange(0, 0, SelectionHasNoDirection, Element::defaultFocusTextStateChangeIntent());
     } else
-        restoreCachedSelection();
+        restoreCachedSelection(Element::defaultFocusTextStateChangeIntent());
 
     if (document().frame())
         document().frame()->selection().revealSelection();

Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (186255 => 186256)


--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -185,15 +185,15 @@
     setSelectionRange(selectionStart(), selectionEnd(), direction);
 }
 
-void HTMLTextFormControlElement::select()
+void HTMLTextFormControlElement::select(const AXTextStateChangeIntent& intent)
 {
     // FIXME: We should abstract the selection behavior into an EditingBehavior function instead
     // of hardcoding the behavior using a macro define.
 #if PLATFORM(IOS)
     // We don't want to select all the text on iOS. Instead use the standard textfield behavior of going to the end of the line.
-    setSelectionRange(std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), SelectionHasForwardDirection);
+    setSelectionRange(std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), SelectionHasForwardDirection, intent);
 #else
-    setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirection);
+    setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirection, intent);
 #endif
 }
 
@@ -272,7 +272,7 @@
     setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection);
 }
 
-void HTMLTextFormControlElement::setSelectionRange(int start, int end, const String& directionString)
+void HTMLTextFormControlElement::setSelectionRange(int start, int end, const String& directionString, const AXTextStateChangeIntent& intent)
 {
     TextFieldSelectionDirection direction = SelectionHasNoDirection;
     if (directionString == "forward")
@@ -280,10 +280,10 @@
     else if (directionString == "backward")
         direction = SelectionHasBackwardDirection;
 
-    return setSelectionRange(start, end, direction);
+    return setSelectionRange(start, end, direction, intent);
 }
 
-void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction)
+void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction, const AXTextStateChangeIntent& intent)
 {
     if (!isTextFormControl())
         return;
@@ -317,7 +317,7 @@
     }
 
     if (Frame* frame = document().frame())
-        frame->selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus);
+        frame->selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus, intent);
 }
 
 int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& position) const
@@ -468,9 +468,9 @@
     return Range::create(document(), startNode, start, endNode, end);
 }
 
-void HTMLTextFormControlElement::restoreCachedSelection()
+void HTMLTextFormControlElement::restoreCachedSelection(const AXTextStateChangeIntent& intent)
 {
-    setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, cachedSelectionDirection());
+    setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, cachedSelectionDirection(), intent);
 }
 
 void HTMLTextFormControlElement::selectionChanged(bool shouldFireSelectEvent)

Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (186255 => 186256)


--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h	2015-07-03 03:34:36 UTC (rev 186256)
@@ -64,11 +64,11 @@
     void setSelectionStart(int);
     void setSelectionEnd(int);
     void setSelectionDirection(const String&);
-    void select();
+    void select(const AXTextStateChangeIntent& = AXTextStateChangeIntent());
     virtual void setRangeText(const String& replacement, ExceptionCode&);
     virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&);
-    void setSelectionRange(int start, int end, const String& direction);
-    void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection);
+    void setSelectionRange(int start, int end, const String& direction, const AXTextStateChangeIntent& = AXTextStateChangeIntent());
+    void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection, const AXTextStateChangeIntent& = AXTextStateChangeIntent());
     PassRefPtr<Range> selection() const;
     String selectedText() const;
 
@@ -110,7 +110,7 @@
         m_cachedSelectionDirection = direction;
     }
 
-    void restoreCachedSelection();
+    void restoreCachedSelection(const AXTextStateChangeIntent& = AXTextStateChangeIntent());
     bool hasCachedSelection() const { return m_cachedSelectionStart >= 0; }
 
     virtual void subtreeHasChanged() = 0;

Modified: trunk/Source/WebCore/page/EventHandler.cpp (186255 => 186256)


--- trunk/Source/WebCore/page/EventHandler.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -3238,7 +3238,7 @@
         break;
     }
 
-    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
+    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false });
     selection.setSelection(visiblePosition, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent);
 }
 

Modified: trunk/Source/WebCore/page/FocusController.cpp (186255 => 186256)


--- trunk/Source/WebCore/page/FocusController.cpp	2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/page/FocusController.cpp	2015-07-03 03:34:36 UTC (rev 186256)
@@ -341,7 +341,7 @@
         Position position = firstPositionInOrBeforeNode(element.get());
         VisibleSelection newSelection(position, position, DOWNSTREAM);
         if (frame.selection().shouldChangeSelection(newSelection)) {
-            AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
+            AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, true });
             frame.selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent);
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to