Changeset 183368 in webkit


Ignore:
Timestamp:
Apr 26, 2015 3:17:11 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

AX: richer text change notifications (142719)
https://bugs.webkit.org/show_bug.cgi?id=142719

Patch by Doug Russell <d_russell@apple.com> on 2015-04-26
Reviewed by Darin Adler.

Richer accessibility value change notifications. Introduce AXTextEditType,
postTextStateChangeNotification and postTextReplacementNotification to give assistive
tech apps more reliable context for responding to changes in web content. Also implement
a mechanism to post value changes in password form fields in coalesced ticks to thwart
analyzing the cadence of changes.

Richer accessibility selection change notifications. Introduce AXTextStateChangeIntent,
and an overload of postTextReplacementNotification to give assistive tech apps more
reliable context for responding to changes in web content selection. Also block posting
selection changes on password fields.

Source/WebCore:

Tests: platform/mac/accessibility/input-replacevalue-userinfo.html

platform/mac/accessibility/selection-change-userinfo.html
platform/mac/accessibility/value-change-userinfo.html

  • CMakeLists.txt:
  • WebCore.vcxproj/WebCore.vcxproj:
  • WebCore.vcxproj/WebCore.vcxproj.filters:
  • WebCore.xcodeproj/project.pbxproj:
  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::notificationPostTimerFired):
(WebCore::AXObjectCache::passwordNotificationPostTimerFired):
(WebCore::AXObjectCache::showIntent):
(WebCore::AXObjectCache::setTextSelectionIntent):
(WebCore::isPasswordFieldOrContainedByPasswordField):
(WebCore::AXObjectCache::postTextStateChangeNotification):
(WebCore::AXObjectCache::postTextReplacementNotification):
(WebCore::AXObjectCache::enqueuePasswordValueChangeNotification):
(WebCore::AXObjectCache::rootWebArea):
(WebCore::AXObjectCache::textChangeForEditType):
(WebCore::AXObjectCache::selectedChildrenChanged): Deleted.
(WebCore::AXObjectCache::frameLoadingEventNotification): Deleted.

  • accessibility/AXObjectCache.h:

(WebCore::AXObjectCache::postTextStateChangeNotification):
(WebCore::AXObjectCache::postTextReplacementNotification):
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
(WebCore::AXObjectCache::postTextReplacementPlatformNotification):
(WebCore::AXObjectCache::textChangeForEditType):
(WebCore::AXObjectCache::nodeTextChangePlatformNotification):
(WebCore::AXObjectCache::computedObjectAttributeCache): Deleted.
(WebCore::AXObjectCache::getOrCreate): Deleted.
(WebCore::AXObjectCache::attachWrapper): Deleted.

  • accessibility/AXTextStateChangeIntent.h: Added.

(WebCore::AXTextStateChangeIntent::AXTextStateChangeIntent):

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::passwordFieldOrContainingPasswordField):

  • accessibility/AccessibilityNodeObject.h:
  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::isContainedByPasswordField):

  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::passwordFieldOrContainingPasswordField):
(WebCore::AccessibilityObject::isPasswordField): Deleted.

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::setSelectedTextRange):
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):

  • accessibility/AccessibilityScrollView.h:
  • accessibility/atk/AXObjectCacheAtk.cpp:

(WebCore::AXObjectCache::nodeTextChangePlatformNotification):

  • accessibility/ios/AXObjectCacheIOS.mm:

(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
(WebCore::AXObjectCache::postTextReplacementPlatformNotification):

  • accessibility/mac/AXObjectCacheMac.mm:

(WebCore::AXObjectCache::setShouldRepostNotificationsForTests):
(WebCore::AXPostNotificationWithUserInfo):
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
(WebCore::textReplacementChangeDictionary):
(WebCore::AXObjectCache::postTextReplacementPlatformNotification):

  • accessibility/mac/WebAccessibilityObjectWrapperBase.h:
  • accessibility/mac/WebAccessibilityObjectWrapperBase.mm:

(+[WebAccessibilityObjectWrapperBase accessibilitySetShouldRepostNotifications:]):
(-[WebAccessibilityObjectWrapperBase accessibilityPostedNotification:]):
(arrayRemovingNonJSONTypes):
(dictionaryRemovingNonJSONTypes):
(-[WebAccessibilityObjectWrapperBase accessibilityPostedNotification:userInfo:]):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.h:
  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(textMarkerRangeFromVisiblePositions):
(-[WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions:endPosition:]):

  • editing/AppendNodeCommand.cpp:

(WebCore::AppendNodeCommand::AppendNodeCommand):
(WebCore::sendAXTextChangedIgnoringLineBreaks):
(WebCore::AppendNodeCommand::doApply):
(WebCore::AppendNodeCommand::doUnapply):

  • editing/AppendNodeCommand.h:

(WebCore::AppendNodeCommand::create):

  • editing/ApplyStyleCommand.cpp:

(WebCore::ApplyStyleCommand::ApplyStyleCommand):
(WebCore::ApplyStyleCommand::applyBlockStyle): Deleted.

  • editing/ApplyStyleCommand.h:
  • editing/CompositeEditCommand.cpp:

(WebCore::EditCommandComposition::unapplyEditType):
(WebCore::CompositeEditCommand::CompositeEditCommand):
(WebCore::CompositeEditCommand::apply):
(WebCore::CompositeEditCommand::insertParagraphSeparator):
(WebCore::CompositeEditCommand::insertNodeBefore):
(WebCore::CompositeEditCommand::appendNode):
(WebCore::CompositeEditCommand::removeNodePreservingChildren):
(WebCore::CompositeEditCommand::insertTextIntoNode):
(WebCore::CompositeEditCommand::deleteTextFromNode):
(WebCore::CompositeEditCommand::replaceTextInNode):
(WebCore::CompositeEditCommand::moveParagraphs):
(WebCore::EditCommandComposition::getNodesInCommand): Deleted.
(WebCore::CompositeEditCommand::applyStyle): Deleted.
(WebCore::CompositeEditCommand::insertLineBreak): Deleted.
(WebCore::CompositeEditCommand::insertNodeAt): Deleted.
(WebCore::CompositeEditCommand::removeChildrenInRange): Deleted.
(WebCore::CompositeEditCommand::inputText): Deleted.

  • editing/CompositeEditCommand.h:
  • editing/DeleteFromTextNodeCommand.cpp:

(WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
(WebCore::DeleteFromTextNodeCommand::doApply):
(WebCore::DeleteFromTextNodeCommand::doUnapply):

  • editing/DeleteFromTextNodeCommand.h:

(WebCore::DeleteFromTextNodeCommand::create):
(WebCore::DeleteFromTextNodeCommand::deletedText):

  • editing/DeleteSelectionCommand.cpp:

(WebCore::DeleteSelectionCommand::DeleteSelectionCommand):
(WebCore::DeleteSelectionCommand::preservesTypingStyle): Deleted.

  • editing/DeleteSelectionCommand.h:

(WebCore::DeleteSelectionCommand::create):

  • editing/DictationCommand.cpp:

(WebCore::DictationCommand::insertTextRunWithoutNewlines):
(WebCore::DictationCommand::insertParagraphSeparator):

  • editing/EditAction.h:
  • editing/EditCommand.cpp:

(WebCore::EditCommand::EditCommand):
(WebCore::EditCommand::editingAction):
(WebCore::EditCommand::applyEditType):
(WebCore::EditCommand::unapplyEditType):
(WebCore::SimpleEditCommand::SimpleEditCommand):
(WebCore::SimpleEditCommand::notifyAccessibilityForTextChange):
(WebCore::EditCommand::setParent): Deleted.

  • editing/EditCommand.h:
  • editing/EditingAllInOne.cpp:
  • editing/Editor.cpp:

(WebCore::Editor::handleTextEvent):
(WebCore::Editor::deleteSelectionWithSmartDelete):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::replaceSelectionWithText):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::unappliedEditing):
(WebCore::Editor::performCutOrCopy):
(WebCore::Editor::markMisspellingsAfterTypingToWord):
(WebCore::Editor::changeBackToReplacedString):
(WebCore::Editor::transpose):
(WebCore::Editor::changeSelectionAfterCommand):

  • editing/Editor.h:
  • editing/EditorCommand.cpp:

(WebCore::executeInsertFragment):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::moveTo):
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelectionByMouseIfDifferent):
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::updateAndRevealSelection):
(WebCore::isBoundary):
(WebCore::FrameSelection::textSelectionIntent):
(WebCore::FrameSelection::modify):
(WebCore::FrameSelection::selectAll):
(WebCore::FrameSelection::wordSelectionContainingCaretSelection):
(WebCore::FrameSelection::modifyMovingBackward): Deleted.
(WebCore::FrameSelection::selectFrameElementInParentIfFullySelected): Deleted.
(WebCore::FrameSelection::selectionAtWordStart): Deleted.

  • editing/FrameSelection.h:

(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
(WebCore::FrameSelection::selection): Deleted.

  • editing/InsertIntoTextNodeCommand.cpp:

(WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
(WebCore::InsertIntoTextNodeCommand::doApply):
(WebCore::InsertIntoTextNodeCommand::doUnapply):

  • editing/InsertIntoTextNodeCommand.h:

(WebCore::InsertIntoTextNodeCommand::create):
(WebCore::InsertIntoTextNodeCommand::insertedText):

  • editing/InsertNodeBeforeCommand.cpp:

(WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand):
(WebCore::InsertNodeBeforeCommand::doApply):
(WebCore::InsertNodeBeforeCommand::doUnapply):

  • editing/InsertNodeBeforeCommand.h:

(WebCore::InsertNodeBeforeCommand::create):

  • editing/InsertParagraphSeparatorCommand.cpp:

(WebCore::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand):

  • editing/InsertParagraphSeparatorCommand.h:

(WebCore::InsertParagraphSeparatorCommand::create):

  • editing/InsertTextCommand.cpp:

(WebCore::InsertTextCommand::InsertTextCommand):

  • editing/InsertTextCommand.h:

(WebCore::InsertTextCommand::create):
(WebCore::InsertTextCommand::createWithMarkerSupplier):

  • editing/MoveSelectionCommand.cpp:

(WebCore::MoveSelectionCommand::doApply):

  • editing/RemoveNodePreservingChildrenCommand.cpp:

(WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand):

  • editing/RemoveNodePreservingChildrenCommand.h:

(WebCore::RemoveNodePreservingChildrenCommand::create):

  • editing/ReplaceDeleteFromTextNodeCommand.cpp: Copied from Source/WebCore/editing/AppendNodeCommand.h.

(WebCore::ReplaceDeleteFromTextNodeCommand::ReplaceDeleteFromTextNodeCommand):
(WebCore::ReplaceDeleteFromTextNodeCommand::notifyAccessibilityForTextChange):

  • editing/ReplaceDeleteFromTextNodeCommand.h: Copied from Source/WebCore/editing/AppendNodeCommand.h.
  • editing/ReplaceInsertIntoTextNodeCommand.cpp: Added.

(WebCore::ReplaceInsertIntoTextNodeCommand::ReplaceInsertIntoTextNodeCommand):
(WebCore::ReplaceInsertIntoTextNodeCommand::notifyAccessibilityForTextChange):

  • editing/ReplaceInsertIntoTextNodeCommand.h: Copied from Source/WebCore/editing/RemoveNodePreservingChildrenCommand.h.
  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::ReplaceSelectionCommand):
(WebCore::ReplaceSelectionCommand::InsertedNodes::didReplaceNode): Deleted.
(WebCore::ReplaceSelectionCommand::insertAsListItems): Deleted.

  • editing/ReplaceSelectionCommand.h:

(WebCore::ReplaceSelectionCommand::create):

  • editing/TypingCommand.cpp:

(WebCore::TypingCommand::insertTextRunWithoutNewlines):
(WebCore::TypingCommand::insertParagraphSeparator):

  • editing/atk/FrameSelectionAtk.cpp:

(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):

  • editing/ios/DictationCommandIOS.cpp:

(WebCore::DictationCommandIOS::DictationCommandIOS):

  • editing/ios/DictationCommandIOS.h:
  • editing/mac/FrameSelectionMac.mm:

(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):

  • html/HTMLTextFormControlElement.cpp:

(WebCore::HTMLTextFormControlElement::setInnerTextValue):

  • page/DragController.cpp:

(WebCore::DragController::concludeEditDrag):

  • page/EventHandler.cpp:

(WebCore::setInitialKeyboardSelection):

  • page/FocusController.cpp:

(WebCore::FocusController::advanceFocusInDocumentOrder):

Source/WebKit/mac:

  • WebCoreSupport/WebEditorClient.mm:

(undoNameForEditAction):

Source/WebKit2:

  • UIProcess/WebEditCommandProxy.cpp:

(WebKit::WebEditCommandProxy::nameForEditAction):

Tools:

  • DumpRenderTree/mac/AccessibilityNotificationHandler.h:
  • DumpRenderTree/mac/AccessibilityNotificationHandler.mm:

(-[AccessibilityNotificationHandler stopObserving]):
(-[AccessibilityNotificationHandler _notificationReceived:]):

  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:

(AccessibilityUIElement::removeNotificationListener):

  • WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:

(-[AccessibilityNotificationHandler _notificationReceived:]):

  • WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:

(WTR::AccessibilityUIElement::removeNotificationListener):

LayoutTests:

  • platform/mac/accessibility/input-replacevalue-userinfo-expected.txt: Added.
  • platform/mac/accessibility/input-replacevalue-userinfo.html: Added.
  • platform/mac/accessibility/selection-change-userinfo-expected.txt: Added.
  • platform/mac/accessibility/selection-change-userinfo.html: Added.
  • platform/mac/accessibility/value-change-userinfo-expected.txt: Added.
  • platform/mac/accessibility/value-change-userinfo.html: Added.
Location:
trunk
Files:
8 added
74 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r183366 r183368  
     12015-04-26  Doug Russell  <d_russell@apple.com>
     2
     3        AX: richer text change notifications (142719)
     4        https://bugs.webkit.org/show_bug.cgi?id=142719
     5
     6        Reviewed by Darin Adler.
     7
     8        Richer accessibility value change notifications. Introduce AXTextEditType,
     9        postTextStateChangeNotification and postTextReplacementNotification to give assistive
     10        tech apps more reliable context for responding to changes in web content. Also implement
     11        a mechanism to post value changes in password form fields in coalesced ticks to thwart
     12        analyzing the cadence of changes.
     13
     14        Richer accessibility selection change notifications. Introduce AXTextStateChangeIntent,
     15        and an overload of postTextReplacementNotification to give assistive tech apps more
     16        reliable context for responding to changes in web content selection. Also block posting
     17        selection changes on password fields.
     18
     19        * platform/mac/accessibility/input-replacevalue-userinfo-expected.txt: Added.
     20        * platform/mac/accessibility/input-replacevalue-userinfo.html: Added.
     21        * platform/mac/accessibility/selection-change-userinfo-expected.txt: Added.
     22        * platform/mac/accessibility/selection-change-userinfo.html: Added.
     23        * platform/mac/accessibility/value-change-userinfo-expected.txt: Added.
     24        * platform/mac/accessibility/value-change-userinfo.html: Added.
     25
    1262015-04-26  Darin Adler  <darin@apple.com>
    227
  • trunk/LayoutTests/platform/mac/TestExpectations

    r183217 r183368  
    12641264webkit.org/b/142548 [ Yosemite+ ] editing/selection/extend-by-character-007.html [ Pass ]
    12651265webkit.org/b/141661 [ Yosemite+ ] fast/text/emoji.html [ Pass ]
     1266
     1267# Timing out on Yosemite & Mavericks WK1 release sometimes
     1268webkit.org/b/142719 platform/mac/accessibility/select-text.html [ Pass Timeout ]
  • trunk/Source/WebCore/CMakeLists.txt

    r183283 r183368  
    15141514    editing/RemoveNodePreservingChildrenCommand.cpp
    15151515    editing/RenderedPosition.cpp
     1516    editing/ReplaceDeleteFromTextNodeCommand.cpp
     1517    editing/ReplaceInsertIntoTextNodeCommand.cpp
    15161518    editing/ReplaceNodeWithSpanCommand.cpp
    15171519    editing/ReplaceSelectionCommand.cpp
  • trunk/Source/WebCore/ChangeLog

    r183367 r183368  
     12015-04-26  Doug Russell  <d_russell@apple.com>
     2
     3        AX: richer text change notifications (142719)
     4        https://bugs.webkit.org/show_bug.cgi?id=142719
     5
     6        Reviewed by Darin Adler.
     7
     8        Richer accessibility value change notifications. Introduce AXTextEditType,
     9        postTextStateChangeNotification and postTextReplacementNotification to give assistive
     10        tech apps more reliable context for responding to changes in web content. Also implement
     11        a mechanism to post value changes in password form fields in coalesced ticks to thwart
     12        analyzing the cadence of changes.
     13
     14        Richer accessibility selection change notifications. Introduce AXTextStateChangeIntent,
     15        and an overload of postTextReplacementNotification to give assistive tech apps more
     16        reliable context for responding to changes in web content selection. Also block posting
     17        selection changes on password fields.
     18
     19        Tests: platform/mac/accessibility/input-replacevalue-userinfo.html
     20               platform/mac/accessibility/selection-change-userinfo.html
     21               platform/mac/accessibility/value-change-userinfo.html
     22
     23        * CMakeLists.txt:
     24        * WebCore.vcxproj/WebCore.vcxproj:
     25        * WebCore.vcxproj/WebCore.vcxproj.filters:
     26        * WebCore.xcodeproj/project.pbxproj:
     27        * accessibility/AXObjectCache.cpp:
     28        (WebCore::AXObjectCache::AXObjectCache):
     29        (WebCore::AXObjectCache::notificationPostTimerFired):
     30        (WebCore::AXObjectCache::passwordNotificationPostTimerFired):
     31        (WebCore::AXObjectCache::showIntent):
     32        (WebCore::AXObjectCache::setTextSelectionIntent):
     33        (WebCore::isPasswordFieldOrContainedByPasswordField):
     34        (WebCore::AXObjectCache::postTextStateChangeNotification):
     35        (WebCore::AXObjectCache::postTextReplacementNotification):
     36        (WebCore::AXObjectCache::enqueuePasswordValueChangeNotification):
     37        (WebCore::AXObjectCache::rootWebArea):
     38        (WebCore::AXObjectCache::textChangeForEditType):
     39        (WebCore::AXObjectCache::selectedChildrenChanged): Deleted.
     40        (WebCore::AXObjectCache::frameLoadingEventNotification): Deleted.
     41        * accessibility/AXObjectCache.h:
     42        (WebCore::AXObjectCache::postTextStateChangeNotification):
     43        (WebCore::AXObjectCache::postTextReplacementNotification):
     44        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
     45        (WebCore::AXObjectCache::postTextReplacementPlatformNotification):
     46        (WebCore::AXObjectCache::textChangeForEditType):
     47        (WebCore::AXObjectCache::nodeTextChangePlatformNotification):
     48        (WebCore::AXObjectCache::computedObjectAttributeCache): Deleted.
     49        (WebCore::AXObjectCache::getOrCreate): Deleted.
     50        (WebCore::AXObjectCache::attachWrapper): Deleted.
     51        * accessibility/AXTextStateChangeIntent.h: Added.
     52        (WebCore::AXTextStateChangeIntent::AXTextStateChangeIntent):
     53        * accessibility/AccessibilityNodeObject.cpp:
     54        (WebCore::AccessibilityNodeObject::passwordFieldOrContainingPasswordField):
     55        * accessibility/AccessibilityNodeObject.h:
     56        * accessibility/AccessibilityObject.cpp:
     57        (WebCore::AccessibilityObject::isContainedByPasswordField):
     58        * accessibility/AccessibilityObject.h:
     59        (WebCore::AccessibilityObject::passwordFieldOrContainingPasswordField):
     60        (WebCore::AccessibilityObject::isPasswordField): Deleted.
     61        * accessibility/AccessibilityRenderObject.cpp:
     62        (WebCore::AccessibilityRenderObject::setSelectedTextRange):
     63        (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
     64        * accessibility/AccessibilityScrollView.h:
     65        * accessibility/atk/AXObjectCacheAtk.cpp:
     66        (WebCore::AXObjectCache::nodeTextChangePlatformNotification):
     67        * accessibility/ios/AXObjectCacheIOS.mm:
     68        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
     69        (WebCore::AXObjectCache::postTextReplacementPlatformNotification):
     70        * accessibility/mac/AXObjectCacheMac.mm:
     71        (WebCore::AXObjectCache::setShouldRepostNotificationsForTests):
     72        (WebCore::AXPostNotificationWithUserInfo):
     73        (WebCore::AXObjectCache::postPlatformNotification):
     74        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
     75        (WebCore::textReplacementChangeDictionary):
     76        (WebCore::AXObjectCache::postTextReplacementPlatformNotification):
     77        * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
     78        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
     79        (+[WebAccessibilityObjectWrapperBase accessibilitySetShouldRepostNotifications:]):
     80        (-[WebAccessibilityObjectWrapperBase accessibilityPostedNotification:]):
     81        (arrayRemovingNonJSONTypes):
     82        (dictionaryRemovingNonJSONTypes):
     83        (-[WebAccessibilityObjectWrapperBase accessibilityPostedNotification:userInfo:]):
     84        * accessibility/mac/WebAccessibilityObjectWrapperMac.h:
     85        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     86        (textMarkerRangeFromVisiblePositions):
     87        (-[WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions:endPosition:]):
     88        * editing/AppendNodeCommand.cpp:
     89        (WebCore::AppendNodeCommand::AppendNodeCommand):
     90        (WebCore::sendAXTextChangedIgnoringLineBreaks):
     91        (WebCore::AppendNodeCommand::doApply):
     92        (WebCore::AppendNodeCommand::doUnapply):
     93        * editing/AppendNodeCommand.h:
     94        (WebCore::AppendNodeCommand::create):
     95        * editing/ApplyStyleCommand.cpp:
     96        (WebCore::ApplyStyleCommand::ApplyStyleCommand):
     97        (WebCore::ApplyStyleCommand::applyBlockStyle): Deleted.
     98        * editing/ApplyStyleCommand.h:
     99        * editing/CompositeEditCommand.cpp:
     100        (WebCore::EditCommandComposition::unapplyEditType):
     101        (WebCore::CompositeEditCommand::CompositeEditCommand):
     102        (WebCore::CompositeEditCommand::apply):
     103        (WebCore::CompositeEditCommand::insertParagraphSeparator):
     104        (WebCore::CompositeEditCommand::insertNodeBefore):
     105        (WebCore::CompositeEditCommand::appendNode):
     106        (WebCore::CompositeEditCommand::removeNodePreservingChildren):
     107        (WebCore::CompositeEditCommand::insertTextIntoNode):
     108        (WebCore::CompositeEditCommand::deleteTextFromNode):
     109        (WebCore::CompositeEditCommand::replaceTextInNode):
     110        (WebCore::CompositeEditCommand::moveParagraphs):
     111        (WebCore::EditCommandComposition::getNodesInCommand): Deleted.
     112        (WebCore::CompositeEditCommand::applyStyle): Deleted.
     113        (WebCore::CompositeEditCommand::insertLineBreak): Deleted.
     114        (WebCore::CompositeEditCommand::insertNodeAt): Deleted.
     115        (WebCore::CompositeEditCommand::removeChildrenInRange): Deleted.
     116        (WebCore::CompositeEditCommand::inputText): Deleted.
     117        * editing/CompositeEditCommand.h:
     118        * editing/DeleteFromTextNodeCommand.cpp:
     119        (WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
     120        (WebCore::DeleteFromTextNodeCommand::doApply):
     121        (WebCore::DeleteFromTextNodeCommand::doUnapply):
     122        * editing/DeleteFromTextNodeCommand.h:
     123        (WebCore::DeleteFromTextNodeCommand::create):
     124        (WebCore::DeleteFromTextNodeCommand::deletedText):
     125        * editing/DeleteSelectionCommand.cpp:
     126        (WebCore::DeleteSelectionCommand::DeleteSelectionCommand):
     127        (WebCore::DeleteSelectionCommand::preservesTypingStyle): Deleted.
     128        * editing/DeleteSelectionCommand.h:
     129        (WebCore::DeleteSelectionCommand::create):
     130        * editing/DictationCommand.cpp:
     131        (WebCore::DictationCommand::insertTextRunWithoutNewlines):
     132        (WebCore::DictationCommand::insertParagraphSeparator):
     133        * editing/EditAction.h:
     134        * editing/EditCommand.cpp:
     135        (WebCore::EditCommand::EditCommand):
     136        (WebCore::EditCommand::editingAction):
     137        (WebCore::EditCommand::applyEditType):
     138        (WebCore::EditCommand::unapplyEditType):
     139        (WebCore::SimpleEditCommand::SimpleEditCommand):
     140        (WebCore::SimpleEditCommand::notifyAccessibilityForTextChange):
     141        (WebCore::EditCommand::setParent): Deleted.
     142        * editing/EditCommand.h:
     143        * editing/EditingAllInOne.cpp:
     144        * editing/Editor.cpp:
     145        (WebCore::Editor::handleTextEvent):
     146        (WebCore::Editor::deleteSelectionWithSmartDelete):
     147        (WebCore::Editor::replaceSelectionWithFragment):
     148        (WebCore::Editor::replaceSelectionWithText):
     149        (WebCore::Editor::appliedEditing):
     150        (WebCore::Editor::unappliedEditing):
     151        (WebCore::Editor::performCutOrCopy):
     152        (WebCore::Editor::markMisspellingsAfterTypingToWord):
     153        (WebCore::Editor::changeBackToReplacedString):
     154        (WebCore::Editor::transpose):
     155        (WebCore::Editor::changeSelectionAfterCommand):
     156        * editing/Editor.h:
     157        * editing/EditorCommand.cpp:
     158        (WebCore::executeInsertFragment):
     159        * editing/FrameSelection.cpp:
     160        (WebCore::FrameSelection::moveTo):
     161        (WebCore::FrameSelection::moveWithoutValidationTo):
     162        (WebCore::FrameSelection::setSelectionByMouseIfDifferent):
     163        (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
     164        (WebCore::FrameSelection::setSelection):
     165        (WebCore::FrameSelection::updateAndRevealSelection):
     166        (WebCore::isBoundary):
     167        (WebCore::FrameSelection::textSelectionIntent):
     168        (WebCore::FrameSelection::modify):
     169        (WebCore::FrameSelection::selectAll):
     170        (WebCore::FrameSelection::wordSelectionContainingCaretSelection):
     171        (WebCore::FrameSelection::modifyMovingBackward): Deleted.
     172        (WebCore::FrameSelection::selectFrameElementInParentIfFullySelected): Deleted.
     173        (WebCore::FrameSelection::selectionAtWordStart): Deleted.
     174        * editing/FrameSelection.h:
     175        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
     176        (WebCore::FrameSelection::selection): Deleted.
     177        * editing/InsertIntoTextNodeCommand.cpp:
     178        (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
     179        (WebCore::InsertIntoTextNodeCommand::doApply):
     180        (WebCore::InsertIntoTextNodeCommand::doUnapply):
     181        * editing/InsertIntoTextNodeCommand.h:
     182        (WebCore::InsertIntoTextNodeCommand::create):
     183        (WebCore::InsertIntoTextNodeCommand::insertedText):
     184        * editing/InsertNodeBeforeCommand.cpp:
     185        (WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand):
     186        (WebCore::InsertNodeBeforeCommand::doApply):
     187        (WebCore::InsertNodeBeforeCommand::doUnapply):
     188        * editing/InsertNodeBeforeCommand.h:
     189        (WebCore::InsertNodeBeforeCommand::create):
     190        * editing/InsertParagraphSeparatorCommand.cpp:
     191        (WebCore::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand):
     192        * editing/InsertParagraphSeparatorCommand.h:
     193        (WebCore::InsertParagraphSeparatorCommand::create):
     194        * editing/InsertTextCommand.cpp:
     195        (WebCore::InsertTextCommand::InsertTextCommand):
     196        * editing/InsertTextCommand.h:
     197        (WebCore::InsertTextCommand::create):
     198        (WebCore::InsertTextCommand::createWithMarkerSupplier):
     199        * editing/MoveSelectionCommand.cpp:
     200        (WebCore::MoveSelectionCommand::doApply):
     201        * editing/RemoveNodePreservingChildrenCommand.cpp:
     202        (WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand):
     203        * editing/RemoveNodePreservingChildrenCommand.h:
     204        (WebCore::RemoveNodePreservingChildrenCommand::create):
     205        * editing/ReplaceDeleteFromTextNodeCommand.cpp: Copied from Source/WebCore/editing/AppendNodeCommand.h.
     206        (WebCore::ReplaceDeleteFromTextNodeCommand::ReplaceDeleteFromTextNodeCommand):
     207        (WebCore::ReplaceDeleteFromTextNodeCommand::notifyAccessibilityForTextChange):
     208        * editing/ReplaceDeleteFromTextNodeCommand.h: Copied from Source/WebCore/editing/AppendNodeCommand.h.
     209        * editing/ReplaceInsertIntoTextNodeCommand.cpp: Added.
     210        (WebCore::ReplaceInsertIntoTextNodeCommand::ReplaceInsertIntoTextNodeCommand):
     211        (WebCore::ReplaceInsertIntoTextNodeCommand::notifyAccessibilityForTextChange):
     212        * editing/ReplaceInsertIntoTextNodeCommand.h: Copied from Source/WebCore/editing/RemoveNodePreservingChildrenCommand.h.
     213        * editing/ReplaceSelectionCommand.cpp:
     214        (WebCore::ReplaceSelectionCommand::ReplaceSelectionCommand):
     215        (WebCore::ReplaceSelectionCommand::InsertedNodes::didReplaceNode): Deleted.
     216        (WebCore::ReplaceSelectionCommand::insertAsListItems): Deleted.
     217        * editing/ReplaceSelectionCommand.h:
     218        (WebCore::ReplaceSelectionCommand::create):
     219        * editing/TypingCommand.cpp:
     220        (WebCore::TypingCommand::insertTextRunWithoutNewlines):
     221        (WebCore::TypingCommand::insertParagraphSeparator):
     222        * editing/atk/FrameSelectionAtk.cpp:
     223        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
     224        * editing/ios/DictationCommandIOS.cpp:
     225        (WebCore::DictationCommandIOS::DictationCommandIOS):
     226        * editing/ios/DictationCommandIOS.h:
     227        * editing/mac/FrameSelectionMac.mm:
     228        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
     229        * html/HTMLTextFormControlElement.cpp:
     230        (WebCore::HTMLTextFormControlElement::setInnerTextValue):
     231        * page/DragController.cpp:
     232        (WebCore::DragController::concludeEditDrag):
     233        * page/EventHandler.cpp:
     234        (WebCore::setInitialKeyboardSelection):
     235        * page/FocusController.cpp:
     236        (WebCore::FocusController::advanceFocusInDocumentOrder):
     237
    12382015-04-26  Darin Adler  <darin@apple.com>
    2239
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r183283 r183368  
    1476514765    </ClCompile>
    1476614766    <ClCompile Include="..\editing\RenderedPosition.cpp">
     14767      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     14768      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     14769      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     14770      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     14771      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     14772      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     14773      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     14774      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     14775      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     14776      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     14777      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     14778      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     14779    </ClCompile>
     14780    <ClCompile Include="..\editing\ReplaceDeleteFromTextNodeCommand.cpp">
     14781      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     14782      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     14783      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     14784      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     14785      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     14786      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     14787      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     14788      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     14789      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     14790      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     14791      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     14792      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     14793    </ClCompile>
     14794    <ClCompile Include="..\editing\ReplaceInsertIntoTextNodeCommand.cpp">
    1476714795      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    1476814796      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     
    1954619574    <ClInclude Include="..\accessibility\AccessibilityTableRow.h" />
    1954719575    <ClInclude Include="..\accessibility\AXObjectCache.h" />
     19576    <ClInclude Include="..\accessibility\AXTextStateChangeIntent.h" />
    1954819577    <ClInclude Include="..\accessibility\win\AccessibilityObjectWrapperWin.h" />
    1954919578    <ClInclude Include="..\page\AdjustViewSizeOrNot.h" />
     
    2108821117    <ClInclude Include="..\editing\RemoveNodePreservingChildrenCommand.h" />
    2108921118    <ClInclude Include="..\editing\RenderedPosition.h" />
     21119    <ClInclude Include="..\editing\ReplaceDeleteFromTextNodeCommand.h" />
     21120    <ClInclude Include="..\editing\ReplaceInsertIntoTextNodeCommand.h" />
    2109021121    <ClInclude Include="..\editing\ReplaceNodeWithSpanCommand.h" />
    2109121122    <ClInclude Include="..\editing\ReplaceSelectionCommand.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r183283 r183368  
    35263526      <Filter>editing</Filter>
    35273527    </ClCompile>
     3528    <ClCompile Include="..\editing\ReplaceDeleteFromTextNodeCommand.cpp">
     3529      <Filter>editing</Filter>
     3530    </ClCompile>
     3531    <ClCompile Include="..\editing\ReplaceInsertIntoTextNodeCommand.cpp">
     3532      <Filter>editing</Filter>
     3533    </ClCompile>
    35283534    <ClCompile Include="..\editing\ReplaceNodeWithSpanCommand.cpp">
    35293535      <Filter>editing</Filter>
     
    76697675      <Filter>accessibility</Filter>
    76707676    </ClInclude>
     7677    <ClInclude Include="..\accessibility\AXTextStateChangeIntent.h">
     7678        <Filter>accessibility</Filter>
     7679    </ClInclude>
    76717680    <ClInclude Include="..\accessibility\win\AccessibilityObjectWrapperWin.h">
    76727681      <Filter>accessibility\win</Filter>
     
    1067610685    </ClInclude>
    1067710686    <ClInclude Include="..\editing\RenderedPosition.h">
     10687      <Filter>editing</Filter>
     10688    </ClInclude>
     10689    <ClInclude Include="..\editing\ReplaceDeleteFromTextNodeCommand.h">
     10690      <Filter>editing</Filter>
     10691    </ClInclude>
     10692    <ClInclude Include="..\editing\ReplaceInsertIntoTextNodeCommand.h">
    1067810693      <Filter>editing</Filter>
    1067910694    </ClInclude>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r183283 r183368  
    32513251                9001788012E0370700648462 /* JSOESStandardDerivatives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */; };
    32523252                9001788112E0370700648462 /* JSOESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001787F12E0370700648462 /* JSOESStandardDerivatives.h */; };
     3253                91C9F2F91AE3BEB00095B61C /* AXTextStateChangeIntent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */; settings = {ATTRIBUTES = (Private, ); }; };
    32533254                9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; };
    32543255                9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    63966397                F544F78815CFB2A800AF33A8 /* PlatformLocale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */; };
    63976398                F544F78915CFB2A800AF33A8 /* PlatformLocale.h in Headers */ = {isa = PBXBuildFile; fileRef = F544F78715CFB2A800AF33A8 /* PlatformLocale.h */; };
     6399                F5528DA51AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */; };
     6400                F5528DA61AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */; };
     6401                F5528DA91AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */; };
     6402                F5528DAA1AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */; };
    63986403                F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; };
    63996404                F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */; };
     
    1050110506                9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESStandardDerivatives.cpp; sourceTree = "<group>"; };
    1050210507                9001787F12E0370700648462 /* JSOESStandardDerivatives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESStandardDerivatives.h; sourceTree = "<group>"; };
     10508                91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AXTextStateChangeIntent.h; sourceTree = "<group>"; };
    1050310509                9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; };
    1050410510                9302B0BE0D79F82C00C7EE83 /* PageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroup.h; sourceTree = "<group>"; };
     
    1404114047                F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformLocale.cpp; sourceTree = "<group>"; };
    1404214048                F544F78715CFB2A800AF33A8 /* PlatformLocale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLocale.h; sourceTree = "<group>"; };
     14049                F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceDeleteFromTextNodeCommand.h; sourceTree = "<group>"; };
     14050                F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceDeleteFromTextNodeCommand.cpp; sourceTree = "<group>"; };
     14051                F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceInsertIntoTextNodeCommand.cpp; sourceTree = "<group>"; };
     14052                F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceInsertIntoTextNodeCommand.h; sourceTree = "<group>"; };
    1404314053                F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTextInputType.cpp; sourceTree = "<group>"; };
    1404414054                F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTextInputType.h; sourceTree = "<group>"; };
     
    1566215672                                2981CAAF131822EC00D12F2A /* AXObjectCache.cpp */,
    1566315673                                29A8121A0FBB9C1D00510293 /* AXObjectCache.h */,
     15674                                91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */,
    1566415675                        );
    1566515676                        path = accessibility;
     
    1779517806                                9B32CDA813DF7FA900F34D13 /* RenderedPosition.cpp */,
    1779617807                                9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */,
     17808                                F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */,
     17809                                F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */,
     17810                                F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */,
     17811                                F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */,
    1779717812                                A89CCC500F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.cpp */,
    1779817813                                A89CCC510F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h */,
     
    2372923744                                0F580FAF149800D400FB5BD8 /* AnimationUtilities.h in Headers */,
    2373023745                                4A4F65721AA997F100E38CDD /* RealtimeMediaSourceCapabilities.h in Headers */,
     23746                                F5528DA51AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h in Headers */,
    2373123747                                93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */,
    2373223748                                1A8F6BBD0DB55CDC001DB794 /* ApplicationCache.h in Headers */,
     
    2565425670                                F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */,
    2565525671                                BCDFD4960E30592F009D10AD /* JSXMLHttpRequestUpload.h in Headers */,
     25672                                F5528DAA1AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h in Headers */,
    2565625673                                1ACE53F70A8D19470022947D /* JSXMLSerializer.h in Headers */,
    2565725674                                1A762C740A074F2600989F5B /* JSXPathEvaluator.h in Headers */,
     
    2670726724                                83C1D428178D5AB400141E68 /* SVGPathSegCurvetoCubicRel.h in Headers */,
    2670826725                                B2227A690D00BF220071B782 /* SVGPathSegCurvetoCubicSmooth.h in Headers */,
     26726                                91C9F2F91AE3BEB00095B61C /* AXTextStateChangeIntent.h in Headers */,
    2670926727                                83C1D429178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothAbs.h in Headers */,
    2671026728                                83C1D42A178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothRel.h in Headers */,
     
    2846528483                                A77979190D6B9D0C003851B9 /* ImageData.cpp in Sources */,
    2846628484                                97205AB51239291000B17380 /* ImageDocument.cpp in Sources */,
     28485                                F5528DA61AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp in Sources */,
    2846728486                                F55B3DC11251F12D003EF269 /* ImageInputType.cpp in Sources */,
    2846828487                                089582550E857A7E00F82C83 /* ImageLoader.cpp in Sources */,
     
    2991229931                                1A2E6E590CC55213004A2062 /* SQLValue.cpp in Sources */,
    2991329932                                4476531B133170990006B789 /* SSLKeyGeneratorIOS.cpp in Sources */,
     29933                                F5528DA91AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp in Sources */,
    2991429934                                93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.cpp in Sources */,
    2991529935                                BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */,
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r183283 r183368  
    11/*
    2  * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009, 2010, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9191using namespace HTMLNames;
    9292
     93// Post value change notifications for password fields or elements contained in password fields at a 40hz interval to thwart analysis of typing cadence
     94static double AccessibilityPasswordValueChangeNotificationInterval = 0.025;
     95
    9396AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(AXID id) const
    9497{
     
    130133    : m_document(document)
    131134    , m_notificationPostTimer(*this, &AXObjectCache::notificationPostTimerFired)
     135    , m_passwordNotificationPostTimer(*this, &AXObjectCache::passwordNotificationPostTimerFired)
    132136{
    133137}
     
    706710    m_notificationPostTimer.stop();
    707711   
    708     // In DRT, posting notifications has a tendency to immediately queue up other notifications, which can lead to unexpected behavior
     712    // In tests, posting notifications has a tendency to immediately queue up other notifications, which can lead to unexpected behavior
    709713    // when the notification list is cleared at the end. Instead copy this list at the start.
    710714    auto notifications = WTF::move(m_notificationsToPost);
     
    743747    }
    744748}
     749
     750void AXObjectCache::passwordNotificationPostTimerFired()
     751{
     752#if PLATFORM(COCOA)
     753    m_passwordNotificationPostTimer.stop();
     754
     755    // In tests, posting notifications has a tendency to immediately queue up other notifications, which can lead to unexpected behavior
     756    // when the notification list is cleared at the end. Instead copy this list at the start.
     757    auto notifications = WTF::move(m_passwordNotificationsToPost);
     758
     759    for (auto& notification : notifications)
     760        postTextStateChangePlatformNotification(notification.get(), AXTextEditTypeInsert, " ", VisiblePosition());
     761#endif
     762}
    745763   
    746764void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, PostTarget postTarget, PostType postType)
     
    851869}
    852870
    853 void AXObjectCache::nodeTextChangeNotification(Node* node, AXTextChange textChange, unsigned offset, const String& text)
     871#ifndef NDEBUG
     872void AXObjectCache::showIntent(const AXTextStateChangeIntent &intent)
     873{
     874    switch (intent.type) {
     875    case AXTextStateChangeTypeUnknown:
     876        dataLog("Unknown");
     877        break;
     878    case AXTextStateChangeTypeEdit:
     879        dataLog("Edit::");
     880        break;
     881    case AXTextStateChangeTypeSelectionMove:
     882        dataLog("Move::");
     883        break;
     884    case AXTextStateChangeTypeSelectionExtend:
     885        dataLog("Extend::");
     886        break;
     887    }
     888    switch (intent.type) {
     889    case AXTextStateChangeTypeUnknown:
     890        break;
     891    case AXTextStateChangeTypeEdit:
     892        switch (intent.change) {
     893        case AXTextEditTypeUnknown:
     894            dataLog("Unknown");
     895            break;
     896        case AXTextEditTypeDelete:
     897            dataLog("Delete");
     898            break;
     899        case AXTextEditTypeInsert:
     900            dataLog("Insert");
     901            break;
     902        case AXTextEditTypeDictation:
     903            dataLog("DictationInsert");
     904            break;
     905        case AXTextEditTypeTyping:
     906            dataLog("TypingInsert");
     907            break;
     908        case AXTextEditTypeCut:
     909            dataLog("Cut");
     910            break;
     911        case AXTextEditTypePaste:
     912            dataLog("Paste");
     913            break;
     914        }
     915        break;
     916    case AXTextStateChangeTypeSelectionMove:
     917    case AXTextStateChangeTypeSelectionExtend:
     918        switch (intent.selection.direction) {
     919        case AXTextSelectionDirectionUnknown:
     920            dataLog("Unknown::");
     921            break;
     922        case AXTextSelectionDirectionBeginning:
     923            dataLog("Beginning::");
     924            break;
     925        case AXTextSelectionDirectionEnd:
     926            dataLog("End::");
     927            break;
     928        case AXTextSelectionDirectionPrevious:
     929            dataLog("Previous::");
     930            break;
     931        case AXTextSelectionDirectionNext:
     932            dataLog("Next::");
     933            break;
     934        case AXTextSelectionDirectionDiscontiguous:
     935            dataLog("Discontiguous::");
     936            break;
     937        }
     938        switch (intent.selection.direction) {
     939        case AXTextSelectionDirectionUnknown:
     940        case AXTextSelectionDirectionBeginning:
     941        case AXTextSelectionDirectionEnd:
     942        case AXTextSelectionDirectionPrevious:
     943        case AXTextSelectionDirectionNext:
     944            switch (intent.selection.granularity) {
     945            case AXTextSelectionGranularityUnknown:
     946                dataLog("Unknown");
     947                break;
     948            case AXTextSelectionGranularityCharacter:
     949                dataLog("Character");
     950                break;
     951            case AXTextSelectionGranularityWord:
     952                dataLog("Word");
     953                break;
     954            case AXTextSelectionGranularityLine:
     955                dataLog("Line");
     956                break;
     957            case AXTextSelectionGranularitySentence:
     958                dataLog("Sentence");
     959                break;
     960            case AXTextSelectionGranularityParagraph:
     961                dataLog("Paragraph");
     962                break;
     963            case AXTextSelectionGranularityPage:
     964                dataLog("Page");
     965                break;
     966            case AXTextSelectionGranularityDocument:
     967                dataLog("Document");
     968                break;
     969            case AXTextSelectionGranularityAll:
     970                dataLog("All");
     971                break;
     972            }
     973            break;
     974        case AXTextSelectionDirectionDiscontiguous:
     975            break;
     976        }
     977        break;
     978    }
     979    if (intent.isSynchronizing)
     980        dataLog("-Sync");
     981    dataLog("\n");
     982}
     983#endif
     984
     985void AXObjectCache::setTextSelectionIntent(AXTextStateChangeIntent intent)
     986{
     987    m_textSelectionIntent = intent;
     988}
     989
     990static bool isPasswordFieldOrContainedByPasswordField(AccessibilityObject* object)
     991{
     992    return object && (object->isPasswordField() || object->isContainedByPasswordField());
     993}
     994
     995void AXObjectCache::postTextStateChangeNotification(Node* node, const AXTextStateChangeIntent& intent, const VisibleSelection& selection)
    854996{
    855997    if (!node)
    856998        return;
    857999
     1000#if PLATFORM(COCOA)
    8581001    stopCachingComputedObjectAttributes();
    8591002
    860     // Delegate on the right platform
    861     AccessibilityObject* obj = getOrCreate(node);
    862     nodeTextChangePlatformNotification(obj, textChange, offset, text);
     1003    AccessibilityObject* object = getOrCreate(node);
     1004    if (object) {
     1005        if (isPasswordFieldOrContainedByPasswordField(object))
     1006            return;
     1007        object = object->observableObject();
     1008    }
     1009
     1010    postTextStateChangePlatformNotification(object, (intent.type == AXTextStateChangeTypeUnknown) ? m_textSelectionIntent : intent, selection);
     1011#else
     1012    postNotification(node->renderer(), AXObjectCache::AXSelectedTextChanged, TargetObservableParent);
     1013    UNUSED_PARAM(intent);
     1014    UNUSED_PARAM(selection);
     1015#endif
     1016
     1017    setTextSelectionIntent(AXTextStateChangeIntent());
     1018}
     1019
     1020void AXObjectCache::postTextStateChangeNotification(Node* node, AXTextEditType type, const String& text, const VisiblePosition& position)
     1021{
     1022    if (!node)
     1023        return;
     1024    ASSERT(type != AXTextEditTypeUnknown);
     1025
     1026    stopCachingComputedObjectAttributes();
     1027
     1028    AccessibilityObject* object = getOrCreate(node);
     1029#if PLATFORM(COCOA)
     1030    if (object) {
     1031        if (enqueuePasswordValueChangeNotification(object))
     1032            return;
     1033        object = object->observableObject();
     1034    }
     1035
     1036    postTextStateChangePlatformNotification(object, type, text, position);
     1037#else
     1038    nodeTextChangePlatformNotification(object, textChangeForEditType(type), position.deepEquivalent().deprecatedEditingOffset(), text);
     1039#endif
     1040}
     1041
     1042void AXObjectCache::postTextReplacementNotification(Node* node, AXTextEditType deletionType, const String& deletedText, AXTextEditType insertionType, const String& insertedText, const VisiblePosition& position)
     1043{
     1044    if (!node)
     1045        return;
     1046    ASSERT(deletionType == AXTextEditTypeDelete);
     1047    ASSERT(insertionType == AXTextEditTypeInsert || insertionType == AXTextEditTypeTyping || insertionType == AXTextEditTypeDictation || insertionType == AXTextEditTypePaste);
     1048
     1049    stopCachingComputedObjectAttributes();
     1050
     1051    AccessibilityObject* object = getOrCreate(node);
     1052#if PLATFORM(COCOA)
     1053    if (object) {
     1054        if (enqueuePasswordValueChangeNotification(object))
     1055            return;
     1056        object = object->observableObject();
     1057    }
     1058
     1059    postTextReplacementPlatformNotification(object, deletionType, deletedText, insertionType, insertedText, position);
     1060#else
     1061    nodeTextChangePlatformNotification(object, textChangeForEditType(deletionType), position.deepEquivalent().deprecatedEditingOffset(), deletedText);
     1062    nodeTextChangePlatformNotification(object, textChangeForEditType(insertionType), position.deepEquivalent().deprecatedEditingOffset(), insertedText);
     1063#endif
     1064}
     1065
     1066bool AXObjectCache::enqueuePasswordValueChangeNotification(AccessibilityObject* object)
     1067{
     1068    if (!isPasswordFieldOrContainedByPasswordField(object))
     1069        return false;
     1070
     1071    AccessibilityObject* observableObject = object->observableObject();
     1072    if (!observableObject) {
     1073        ASSERT_NOT_REACHED();
     1074        // return true even though the enqueue didn't happen because this is a password field and caller shouldn't post a notification
     1075        return true;
     1076    }
     1077
     1078    m_passwordNotificationsToPost.add(observableObject);
     1079    if (!m_passwordNotificationPostTimer.isActive())
     1080        m_passwordNotificationPostTimer.startOneShot(AccessibilityPasswordValueChangeNotificationInterval);
     1081
     1082    return true;
    8631083}
    8641084
     
    10851305}
    10861306
     1307AccessibilityObject* AXObjectCache::rootWebArea()
     1308{
     1309    AccessibilityObject* rootObject = this->rootObject();
     1310    if (!rootObject || !rootObject->isAccessibilityScrollView())
     1311        return nullptr;
     1312    return downcast<AccessibilityScrollView>(*rootObject).webAreaObject();
     1313}
     1314
    10871315AXAttributeCacheEnabler::AXAttributeCacheEnabler(AXObjectCache* cache)
    10881316    : m_cache(cache)
     
    10971325        m_cache->stopCachingComputedObjectAttributes();
    10981326}
     1327
     1328#if !PLATFORM(COCOA)
     1329AXTextChange AXObjectCache::textChangeForEditType(AXTextEditType type)
     1330{
     1331    switch (type) {
     1332    case AXTextEditTypeCut:
     1333    case AXTextEditTypeDelete:
     1334        return AXTextDeleted;
     1335    case AXTextEditTypeInsert:
     1336    case AXTextEditTypeDictation:
     1337    case AXTextEditTypeTyping:
     1338    case AXTextEditTypePaste:
     1339        return AXTextInserted;
     1340    case AXTextEditTypeUnknown:
     1341        break;
     1342    }
     1343    ASSERT_NOT_REACHED();
     1344    return AXTextInserted;
     1345}
     1346#endif
    10991347   
    11001348} // namespace WebCore
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r183283 r183368  
    11/*
    2  * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#define AXObjectCache_h
    2828
     29#include "AXTextStateChangeIntent.h"
    2930#include "AccessibilityObject.h"
    3031#include "Timer.h"
     
    3334#include <wtf/HashMap.h>
    3435#include <wtf/HashSet.h>
     36#include <wtf/ListHashSet.h>
    3537#include <wtf/RefPtr.h>
    3638
     
    6769    HashMap<AXID, CachedAXObjectAttributes> m_idMapping;
    6870};
     71
     72#if !PLATFORM(COCOA)
     73enum AXTextChange { AXTextInserted, AXTextDeleted };
     74#endif
    6975
    7076enum PostTarget { TargetElement, TargetObservableParent };
     
    190196    void postNotification(AccessibilityObject*, Document*, AXNotification, PostTarget = TargetElement, PostType = PostAsynchronously);
    191197
    192     enum AXTextChange {
    193         AXTextInserted,
    194         AXTextDeleted,
    195     };
    196 
    197     void nodeTextChangeNotification(Node*, AXTextChange, unsigned offset, const String&);
     198#ifndef NDEBUG
     199    void showIntent(const AXTextStateChangeIntent&);
     200#endif
     201
     202    void setTextSelectionIntent(AXTextStateChangeIntent);
     203
     204    void postTextStateChangeNotification(Node*, AXTextEditType, const String&, const VisiblePosition&);
     205    void postTextReplacementNotification(Node*, AXTextEditType deletionType, const String& deletedText, AXTextEditType insertionType, const String& insertedText, const VisiblePosition&);
     206    void postTextStateChangeNotification(Node*, const AXTextStateChangeIntent&, const VisibleSelection&);
    198207
    199208    enum AXLoadingEvent {
     
    214223
    215224    Document& document() const { return m_document; }
    216    
     225
     226#if PLATFORM(MAC)
     227    static void setShouldRepostNotificationsForTests(bool value);
     228#endif
     229
    217230protected:
    218231    void postPlatformNotification(AccessibilityObject*, AXNotification);
    219232    void platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);
    220233
    221     void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, const String&);
     234#if PLATFORM(COCOA)
     235    void postTextStateChangePlatformNotification(AccessibilityObject*, const AXTextStateChangeIntent&, const VisibleSelection&);
     236    void postTextStateChangePlatformNotification(AccessibilityObject*, AXTextEditType, const String&, const VisiblePosition&);
     237    void postTextReplacementPlatformNotification(AccessibilityObject*, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&);
     238#else
     239    static AXTextChange textChangeForEditType(AXTextEditType);
     240    void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&);
     241#endif
     242
    222243    void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent);
    223244    void textChanged(AccessibilityObject*);
     
    230251
    231252private:
     253    AccessibilityObject* rootWebArea();
     254
     255    static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*);
     256
     257    AXID getAXID(AccessibilityObject*);
     258
     259    void notificationPostTimerFired();
     260
     261    bool enqueuePasswordValueChangeNotification(AccessibilityObject*);
     262    void passwordNotificationPostTimerFired();
     263
     264    void handleMenuOpened(Node*);
     265    void handleLiveRegionCreated(Node*);
     266    void handleMenuItemSelected(Node*);
     267
    232268    Document& m_document;
    233269    HashMap<AXID, RefPtr<AccessibilityObject>> m_objects;
     
    239275    WEBCORE_EXPORT static bool gAccessibilityEnabled;
    240276    WEBCORE_EXPORT static bool gAccessibilityEnhancedUserInterfaceEnabled;
    241    
     277
    242278    HashSet<AXID> m_idsInUse;
    243    
     279
    244280    Timer m_notificationPostTimer;
    245281    Vector<std::pair<RefPtr<AccessibilityObject>, AXNotification>> m_notificationsToPost;
    246     void notificationPostTimerFired();
    247     void handleMenuOpened(Node*);
    248     void handleLiveRegionCreated(Node*);
    249     void handleMenuItemSelected(Node*);
    250    
    251     static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*);
    252    
    253     AXID getAXID(AccessibilityObject*);
     282
     283    Timer m_passwordNotificationPostTimer;
     284
     285    ListHashSet<RefPtr<AccessibilityObject>> m_passwordNotificationsToPost;
     286
     287    AXTextStateChangeIntent m_textSelectionIntent;
    254288};
    255289
     
    309343inline void AXObjectCache::recomputeIsIgnored(RenderObject*) { }
    310344inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
    311 inline void AXObjectCache::nodeTextChangeNotification(Node*, AXTextChange, unsigned, const String&) { }
    312 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
     345inline void AXObjectCache::postTextStateChangeNotification(Node*, const AXTextStateChangeIntent&, const VisibleSelection&) { }
     346inline void AXObjectCache::postTextStateChangeNotification(Node*, AXTextEditType, const String&, const VisiblePosition&) { }
     347inline void AXObjectCache::postTextReplacementNotification(Node*, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&) { }
    313348inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, PostTarget, PostType) { }
    314349inline void AXObjectCache::postNotification(RenderObject*, AXNotification, PostTarget, PostType) { }
     
    321356inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
    322357inline void AXObjectCache::selectedChildrenChanged(Node*) { }
     358#if PLATFORM(COCOA)
     359inline void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject*, const AXTextStateChangeIntent&, const VisibleSelection&) { }
     360inline void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject*, AXTextEditType, const String&, const VisiblePosition&) { }
     361inline void AXObjectCache::postTextReplacementPlatformNotification(AccessibilityObject*, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&) { }
     362#else
     363inline AXTextChange AXObjectCache::textChangeForEditType(AXTextEditType) { return AXTextInserted; }
     364inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { }
     365#endif
    323366#endif
    324367
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r183283 r183368  
    553553}
    554554
     555AccessibilityObject* AccessibilityNodeObject::passwordFieldOrContainingPasswordField()
     556{
     557    Node* node = this->node();
     558    if (!node)
     559        return nullptr;
     560
     561    if (HTMLInputElement* inputElement = node->toInputElement()) {
     562        if (inputElement->isPasswordField())
     563            return this;
     564    }
     565
     566    Element* element = node->shadowHost();
     567    if (!element || !is<HTMLInputElement>(element))
     568        return nullptr;
     569
     570    if (AXObjectCache* cache = axObjectCache())
     571        return cache->getOrCreate(element);
     572
     573    return nullptr;
     574}
     575
    555576bool AccessibilityNodeObject::isInputImage() const
    556577{
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h

    r183283 r183368  
    8989    virtual bool isNativeTextControl() const override;
    9090    virtual bool isPasswordField() const override;
     91    virtual AccessibilityObject* passwordFieldOrContainingPasswordField() override;
    9192    virtual bool isProgressIndicator() const override;
    9293    virtual bool isSearchField() const override;
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r183283 r183368  
    26472647#endif
    26482648
     2649bool AccessibilityObject::isContainedByPasswordField() const
     2650{
     2651    Node* node = this->node();
     2652    if (!node)
     2653        return false;
     2654   
     2655    if (ariaRoleAttribute() != UnknownRole)
     2656        return false;
     2657
     2658    Element* element = node->shadowHost();
     2659    return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(*element).isPasswordField();
     2660}
     2661
    26492662} // namespace WebCore
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r183283 r183368  
    464464    virtual bool isImageButton() const { return false; }
    465465    virtual bool isPasswordField() const { return false; }
     466    bool isContainedByPasswordField() const;
     467    virtual AccessibilityObject* passwordFieldOrContainingPasswordField() { return nullptr; }
    466468    virtual bool isNativeTextControl() const { return false; }
    467469    virtual bool isSearchField() const { return false; }
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r183283 r183368  
    14921492{
    14931493    if (isNativeTextControl()) {
     1494        if (AXObjectCache* cache = axObjectCache())
     1495            cache->setTextSelectionIntent(AXTextStateChangeIntent(range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove, true));
    14941496        HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement();
    14951497        textControl.setSelectionRange(range.start, range.start + range.length);
     
    14981500
    14991501    Node* node = m_renderer->node();
    1500     m_renderer->frame().selection().setSelection(VisibleSelection(Position(node, range.start, Position::PositionIsOffsetInAnchor),
    1501         Position(node, range.start + range.length, Position::PositionIsOffsetInAnchor), DOWNSTREAM));
     1502    VisibleSelection newSelection(Position(node, range.start, Position::PositionIsOffsetInAnchor), Position(node, range.start + range.length, Position::PositionIsOffsetInAnchor), DOWNSTREAM);
     1503    AXTextStateChangeIntent newIntent(range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove, true);
     1504    m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), newIntent);
    15021505}
    15031506
     
    19641967    if (range.start.isNull() || range.end.isNull())
    19651968        return;
    1966    
     1969
    19671970    // make selection and tell the document to use it. if it's zero length, then move to that position
    1968     if (range.start == range.end)
     1971    if (range.start == range.end) {
     1972        if (AXObjectCache* cache = axObjectCache())
     1973            cache->setTextSelectionIntent(AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, true));
    19691974        m_renderer->frame().selection().moveTo(range.start, UserTriggered);
     1975    }
    19701976    else {
    19711977        VisibleSelection newSelection = VisibleSelection(range.start, range.end);
    1972         m_renderer->frame().selection().setSelection(newSelection);
     1978        m_renderer->frame().selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), AXTextStateChangeIntent(AXTextStateChangeTypeSelectionExtend, true));
    19731979    }
    19741980}
  • trunk/Source/WebCore/accessibility/AccessibilityScrollView.h

    r183283 r183368  
    4444    virtual void detach(AccessibilityDetachmentType, AXObjectCache*) override;
    4545
     46    AccessibilityObject* webAreaObject() const;
     47
    4648private:
    4749    explicit AccessibilityScrollView(ScrollView*);
     
    7274    virtual AccessibilityObject* parentObjectIfExists() const override;
    7375   
    74     AccessibilityObject* webAreaObject() const;
    7576    virtual AccessibilityObject* firstChild() const override { return webAreaObject(); }
    7677    AccessibilityScrollbar* addChildScrollbar(Scrollbar*);
  • trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp

    r183283 r183368  
    269269    CString detail;
    270270    switch (textChange) {
    271     case AXObjectCache::AXTextInserted:
     271    case AXTextInserted:
    272272        detail = "text-insert";
    273273        break;
    274     case AXObjectCache::AXTextDeleted:
     274    case AXTextDeleted:
    275275        detail = "text-remove";
    276276        break;
  • trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm

    r183283 r183368  
    9696}
    9797
    98 void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&)
     98void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, const AXTextStateChangeIntent&, const VisibleSelection&)
    9999{
     100    postPlatformNotification(object, AXSelectedTextChanged);
     101}
     102
     103void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, AXTextEditType, const String&, const VisiblePosition&)
     104{
     105    postPlatformNotification(object, AXValueChanged);
     106}
     107
     108void AXObjectCache::postTextReplacementPlatformNotification(AccessibilityObject* object, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&)
     109{
     110    postPlatformNotification(object, AXValueChanged);
    100111}
    101112
  • trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm

    r183283 r183368  
    4545#endif
    4646
     47#ifndef NSAccessibilityTextStateChangeTypeKey
     48#define NSAccessibilityTextStateChangeTypeKey @"AXTextStateChangeType"
     49#endif
     50
     51#ifndef NSAccessibilityTextStateSyncKey
     52#define NSAccessibilityTextStateSyncKey @"AXTextStateSync"
     53#endif
     54
     55#ifndef NSAccessibilityTextSelectionDirection
     56#define NSAccessibilityTextSelectionDirection @"AXTextSelectionDirection"
     57#endif
     58
     59#ifndef NSAccessibilityTextSelectionGranularity
     60#define NSAccessibilityTextSelectionGranularity @"AXTextSelectionGranularity"
     61#endif
     62
     63#ifndef NSAccessibilityTextEditType
     64#define NSAccessibilityTextEditType @"AXTextEditType"
     65#endif
     66
     67#ifndef NSAccessibilityTextChangeValues
     68#define NSAccessibilityTextChangeValues @"AXTextChangeValues"
     69#endif
     70
     71#ifndef NSAccessibilityTextChangeValue
     72#define NSAccessibilityTextChangeValue @"AXTextChangeValue"
     73#endif
     74
     75#ifndef NSAccessibilityTextChangeValueLength
     76#define NSAccessibilityTextChangeValueLength @"AXTextChangeValueLength"
     77#endif
     78
     79#ifndef NSAccessibilityTextChangeValueStartMarker
     80#define NSAccessibilityTextChangeValueStartMarker @"AXTextChangeValueStartMarker"
     81#endif
     82
     83#ifndef NSAccessibilityTextChangeElement
     84#define NSAccessibilityTextChangeElement @"AXTextChangeElement"
     85#endif
     86
     87#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
     88#define NSAccessibilitySelectedTextMarkerRangeAttribute @"AXSelectedTextMarkerRange"
     89#endif
     90
     91// Very large strings can negatively impact the performance of notifications, so this length is chosen to try to fit an average paragraph or line of text, but not allow strings to be large enough to hurt performance.
     92static const NSUInteger AXValueChangeTruncationLength = 1000;
     93
    4794// The simple Cocoa calls in this file don't throw exceptions.
    4895
     
    59106    RetainPtr<WebAccessibilityObjectWrapper> wrapper = adoptNS([[WebAccessibilityObjectWrapper alloc] initWithAccessibilityObject:obj]);
    60107    obj->setWrapper(wrapper.get());
     108}
     109
     110static BOOL axShouldRepostNotificationsForTests = false;
     111
     112void AXObjectCache::setShouldRepostNotificationsForTests(bool value)
     113{
     114    axShouldRepostNotificationsForTests = value;
     115}
     116
     117static void AXPostNotificationWithUserInfo(id object, NSString *notification, id userInfo)
     118{
     119    NSAccessibilityPostNotificationWithUserInfo(object, notification, userInfo);
     120    // To simplify monitoring for notifications in tests, repost as a simple NSNotification instead of forcing test infrastucture to setup an IPC client and do all the translation between WebCore types and platform specific IPC types and back
     121    if (UNLIKELY(axShouldRepostNotificationsForTests))
     122        [object accessibilityPostedNotification:notification userInfo:userInfo];
    61123}
    62124
     
    150212    ASSERT([obj->wrapper() accessibilityIsIgnored] || true);
    151213#pragma clang diagnostic pop
    152    
    153     NSAccessibilityPostNotification(obj->wrapper(), macNotification);
    154    
    155     // Used by DRT to know when notifications are posted.
    156     [obj->wrapper() accessibilityPostedNotification:macNotification];
    157 }
    158 
    159 void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&)
    160 {
     214
     215    AXPostNotificationWithUserInfo(obj->wrapper(), macNotification, nil);
     216}
     217
     218void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, const AXTextStateChangeIntent& intent, const VisibleSelection& selection)
     219{
     220    if (!object)
     221        object = rootWebArea();
     222
     223    if (!object)
     224        return;
     225
     226    NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] initWithCapacity:5];
     227    if (intent.isSynchronizing)
     228        [userInfo setObject:[NSNumber numberWithBool:YES] forKey:NSAccessibilityTextStateSyncKey];
     229    if (intent.type != AXTextStateChangeTypeUnknown) {
     230        [userInfo setObject:[NSNumber numberWithInt:intent.type] forKey:NSAccessibilityTextStateChangeTypeKey];
     231        switch (intent.type) {
     232        case AXTextStateChangeTypeSelectionMove:
     233        case AXTextStateChangeTypeSelectionExtend:
     234            [userInfo setObject:[NSNumber numberWithInt:intent.selection.direction] forKey:NSAccessibilityTextSelectionDirection];
     235            switch (intent.selection.direction) {
     236            case AXTextSelectionDirectionUnknown:
     237                break;
     238            case AXTextSelectionDirectionBeginning:
     239            case AXTextSelectionDirectionEnd:
     240            case AXTextSelectionDirectionPrevious:
     241            case AXTextSelectionDirectionNext:
     242                [userInfo setObject:[NSNumber numberWithInt:intent.selection.granularity] forKey:NSAccessibilityTextSelectionGranularity];
     243                break;
     244            case AXTextSelectionDirectionDiscontiguous:
     245                break;
     246            }
     247            break;
     248        case AXTextStateChangeTypeUnknown:
     249        case AXTextStateChangeTypeEdit:
     250            break;
     251        }
     252    }
     253    if (!selection.isNone()) {
     254        if (id textMarkerRange = [object->wrapper() textMarkerRangeFromVisiblePositions:selection.visibleStart() endPosition:selection.visibleEnd()])
     255            [userInfo setObject:textMarkerRange forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
     256    }
     257
     258    if (id wrapper = object->wrapper())
     259        [userInfo setObject:wrapper forKey:NSAccessibilityTextChangeElement];
     260
     261    AXPostNotificationWithUserInfo(rootWebArea()->wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
     262    AXPostNotificationWithUserInfo(object->wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
     263
     264    [userInfo release];
     265}
     266
     267static NSDictionary *textReplacementChangeDictionary(AccessibilityObject* object, AXTextEditType type, const String& string, const VisiblePosition& position)
     268{
     269    NSString *text = (NSString *)string;
     270    NSUInteger length = [text length];
     271    if (!length)
     272        return nil;
     273    NSMutableDictionary *change = [[NSMutableDictionary alloc] initWithCapacity:4];
     274    [change setObject:[NSNumber numberWithInt:type] forKey:NSAccessibilityTextEditType];
     275    if (length > AXValueChangeTruncationLength) {
     276        [change setObject:[NSNumber numberWithInt:length] forKey:NSAccessibilityTextChangeValueLength];
     277        text = [text substringToIndex:AXValueChangeTruncationLength];
     278    }
     279    [change setObject:text forKey:NSAccessibilityTextChangeValue];
     280    if (position.isNotNull()) {
     281        if (id textMarker = [object->wrapper() textMarkerForVisiblePosition:position])
     282            [change setObject:textMarker forKey:NSAccessibilityTextChangeValueStartMarker];
     283    }
     284    return [change autorelease];
     285}
     286
     287void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, AXTextEditType type, const String& text, const VisiblePosition& position)
     288{
     289    if (!text.length())
     290        return;
     291
     292    postTextReplacementPlatformNotification(object, AXTextEditTypeUnknown, "", type, text, position);
     293}
     294
     295void AXObjectCache::postTextReplacementPlatformNotification(AccessibilityObject* object, AXTextEditType deletionType, const String& deletedText, AXTextEditType insertionType, const String& insertedText, const VisiblePosition& position)
     296{
     297    if (!object)
     298        object = rootWebArea();
     299
     300    if (!object)
     301        return;
     302
     303    NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] initWithCapacity:4];
     304    userInfo[NSAccessibilityTextStateChangeTypeKey] = @(AXTextStateChangeTypeEdit);
     305
     306    NSMutableArray *changes = [[NSMutableArray alloc] initWithCapacity:2];
     307    if (NSDictionary *change = textReplacementChangeDictionary(object, deletionType, deletedText, position))
     308        [changes addObject:change];
     309    if (NSDictionary *change = textReplacementChangeDictionary(object, insertionType, insertedText, position))
     310        [changes addObject:change];
     311    if (changes.count)
     312        [userInfo setObject:changes forKey:NSAccessibilityTextChangeValues];
     313    [changes release];
     314
     315    if (id wrapper = object->wrapper())
     316        userInfo[NSAccessibilityTextChangeElement] = wrapper;
     317
     318    AXPostNotificationWithUserInfo(rootWebArea()->wrapper(), NSAccessibilityValueChangedNotification, userInfo);
     319    AXPostNotificationWithUserInfo(object->wrapper(), NSAccessibilityValueChangedNotification, userInfo);
     320
     321    [userInfo release];
    161322}
    162323
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h

    r183283 r183368  
    5757
    5858- (id)attachmentView;
    59 // Used to inform an element when a notification is posted for it. Used by DRT.
     59// Used to inform an element when a notification is posted for it. Used by tests.
    6060- (void)accessibilityPostedNotification:(NSString *)notificationName;
     61- (void)accessibilityPostedNotification:(NSString *)notificationName userInfo:(NSDictionary *)userInfo;
    6162
    6263- (CGPathRef)convertPathToScreenSpace:(WebCore::Path &)path;
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm

    r183283 r183368  
    384384{
    385385    accessibilityShouldRepostNotifications = repost;
     386#if PLATFORM(MAC)
     387    AXObjectCache::setShouldRepostNotificationsForTests(repost);
     388#endif
    386389}
    387390
    388391- (void)accessibilityPostedNotification:(NSString *)notificationName
    389392{
     393    if (accessibilityShouldRepostNotifications)
     394        [self accessibilityPostedNotification:notificationName userInfo:nil];
     395}
     396
     397static NSArray *arrayRemovingNonJSONTypes(NSArray *array)
     398{
     399    ASSERT([array isKindOfClass:[NSArray class]]);
     400    NSMutableArray *mutableArray = [array mutableCopy];
     401    for (NSUInteger i = 0; i < [mutableArray count];) {
     402        id value = [mutableArray objectAtIndex:i];
     403        if ([value isKindOfClass:[NSDictionary class]])
     404            [mutableArray replaceObjectAtIndex:i withObject:dictionaryRemovingNonJSONTypes(value)];
     405        else if ([value isKindOfClass:[NSArray class]])
     406            [mutableArray replaceObjectAtIndex:i withObject:arrayRemovingNonJSONTypes(value)];
     407        else if (!([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]])) {
     408            [mutableArray removeObjectAtIndex:i];
     409            continue;
     410        }
     411        i++;
     412    }
     413    return [mutableArray autorelease];
     414}
     415
     416static NSDictionary *dictionaryRemovingNonJSONTypes(NSDictionary *dictionary)
     417{
     418    ASSERT([dictionary isKindOfClass:[NSDictionary class]]);
     419    NSMutableDictionary *mutableDictionary = [dictionary mutableCopy];
     420    for (NSString *key in dictionary) {
     421        id value = [dictionary objectForKey:key];
     422        if ([value isKindOfClass:[NSDictionary class]])
     423            [mutableDictionary setObject:dictionaryRemovingNonJSONTypes(value) forKey:key];
     424        else if ([value isKindOfClass:[NSArray class]])
     425            [mutableDictionary setObject:arrayRemovingNonJSONTypes(value) forKey:key];
     426        else if (!([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]]))
     427            [mutableDictionary removeObjectForKey:key];
     428    }
     429    return [mutableDictionary autorelease];
     430}
     431
     432- (void)accessibilityPostedNotification:(NSString *)notificationName userInfo:(NSDictionary *)userInfo
     433{
    390434    if (accessibilityShouldRepostNotifications) {
    391         NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys:notificationName, @"notificationName", nil];
    392         [[NSNotificationCenter defaultCenter] postNotificationName:@"AXDRTNotification" object:self userInfo:userInfo];
     435        ASSERT(notificationName);
     436        NSDictionary *info = nil;
     437        if (userInfo) {
     438            NSData *userInfoData = [NSJSONSerialization dataWithJSONObject:dictionaryRemovingNonJSONTypes(userInfo) options:(NSJSONWritingOptions)0 error:nil];
     439            if (userInfoData) {
     440                NSString *userInfoString = [[NSString alloc] initWithData:userInfoData encoding:NSUTF8StringEncoding];
     441                if (userInfoString)
     442                    info = [NSDictionary dictionaryWithObjectsAndKeys:notificationName, @"notificationName", userInfoString, @"userInfo", nil];
     443                [userInfoString release];
     444            }
     445        }
     446        if (!info)
     447            info = [NSDictionary dictionaryWithObjectsAndKeys:notificationName, @"notificationName", nil];
     448        [[NSNotificationCenter defaultCenter] postNotificationName:@"AXDRTNotification" object:self userInfo:info];
    393449    }
    394450}
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.h

    r183283 r183368  
    3434@interface WebAccessibilityObjectWrapper : WebAccessibilityObjectWrapperBase
    3535
     36- (id)textMarkerRangeFromVisiblePositions:(const WebCore::VisiblePosition&)startPosition endPosition:(const WebCore::VisiblePosition&)endPosition;
     37- (id)textMarkerForVisiblePosition:(const WebCore::VisiblePosition&)visiblePos;
     38
    3639@end
    3740
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r183283 r183368  
    11371137}
    11381138
    1139 static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, VisiblePosition startPosition, VisiblePosition endPosition)
     1139static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const VisiblePosition& startPosition, const VisiblePosition& endPosition)
    11401140{
    11411141    id startTextMarker = textMarkerForVisiblePosition(cache, startPosition);
     
    11441144}
    11451145
    1146 - (id)textMarkerRangeFromVisiblePositions:(VisiblePosition)startPosition endPosition:(VisiblePosition)endPosition
     1146- (id)textMarkerRangeFromVisiblePositions:(const VisiblePosition&)startPosition endPosition:(const VisiblePosition&)endPosition
    11471147{
    11481148    return textMarkerRangeFromVisiblePositions(m_object->axObjectCache(), startPosition, endPosition);
  • trunk/Source/WebCore/editing/AppendNodeCommand.cpp

    r183283 r183368  
    3131#include "ExceptionCodePlaceholder.h"
    3232#include "RenderElement.h"
     33#include "Text.h"
    3334#include "htmlediting.h"
    3435
    3536namespace WebCore {
    3637
    37 AppendNodeCommand::AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node)
    38     : SimpleEditCommand(parent->document())
     38AppendNodeCommand::AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node, EditAction editingAction)
     39    : SimpleEditCommand(parent->document(), editingAction)
    3940    , m_parent(parent)
    4041    , m_node(node)
     
    4748}
    4849
    49 static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXObjectCache::AXTextChange textChange)
     50static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXTextEditType type)
    5051{
    51     String nodeValue = node->nodeValue();
     52    if (!node)
     53        return;
     54
     55    if (!AXObjectCache::accessibilityEnabled())
     56        return;
     57
     58    String text = node->nodeValue();
    5259    // Don't consider linebreaks in this command
    53     if (nodeValue == "\n")
     60    if (text == "\n")
    5461      return;
    5562
    56     if (AXObjectCache* cache = node->document().existingAXObjectCache())
    57         cache->nodeTextChangeNotification(node, textChange, 0, nodeValue);
     63    if (AXObjectCache* cache = node->document().existingAXObjectCache()) {
     64        Position position = is<Text>(node) ? Position(downcast<Text>(node), 0) : createLegacyEditingPosition(node, 0);
     65        cache->postTextStateChangeNotification(node, type, text, VisiblePosition(position));
     66    }
    5867}
    5968
     
    6574    m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION);
    6675
    67     if (AXObjectCache::accessibilityEnabled())
    68         sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextInserted);
     76    sendAXTextChangedIgnoringLineBreaks(m_node.get(), applyEditType());
    6977}
    7078
     
    7381    if (!m_parent->hasEditableStyle())
    7482        return;
    75        
     83
    7684    // Need to notify this before actually deleting the text
    77     if (AXObjectCache::accessibilityEnabled())
    78         sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextDeleted);
     85    sendAXTextChangedIgnoringLineBreaks(m_node.get(), unapplyEditType());
    7986
    8087    m_node->remove(IGNORE_EXCEPTION);
  • trunk/Source/WebCore/editing/AppendNodeCommand.h

    r183283 r183368  
    3333class AppendNodeCommand : public SimpleEditCommand {
    3434public:
    35     static Ref<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node)
     35    static Ref<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node, EditAction editingAction)
    3636    {
    37         return adoptRef(*new AppendNodeCommand(parent, node));
     37        return adoptRef(*new AppendNodeCommand(parent, node, editingAction));
    3838    }
    3939
    4040private:
    41     AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>);
     41    AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>, EditAction);
    4242
    4343    virtual void doApply() override;
  • trunk/Source/WebCore/editing/ApplyStyleCommand.cpp

    r183283 r183368  
    124124
    125125ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* style, EditAction editingAction, EPropertyLevel propertyLevel)
    126     : CompositeEditCommand(document)
     126    : CompositeEditCommand(document, editingAction)
    127127    , m_style(style->copy())
    128     , m_editingAction(editingAction)
    129128    , m_propertyLevel(propertyLevel)
    130129    , m_start(endingSelection().start().downstream())
     
    137136
    138137ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* style, const Position& start, const Position& end, EditAction editingAction, EPropertyLevel propertyLevel)
    139     : CompositeEditCommand(document)
     138    : CompositeEditCommand(document, editingAction)
    140139    , m_style(style->copy())
    141     , m_editingAction(editingAction)
    142140    , m_propertyLevel(propertyLevel)
    143141    , m_start(start)
     
    150148
    151149ApplyStyleCommand::ApplyStyleCommand(PassRefPtr<Element> element, bool removeOnly, EditAction editingAction)
    152     : CompositeEditCommand(element->document())
     150    : CompositeEditCommand(element->document(), editingAction)
    153151    , m_style(EditingStyle::create())
    154     , m_editingAction(editingAction)
    155152    , m_propertyLevel(PropertyDefault)
    156153    , m_start(endingSelection().start().downstream())
     
    164161
    165162ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction editingAction)
    166     : CompositeEditCommand(document)
     163    : CompositeEditCommand(document, editingAction)
    167164    , m_style(style->copy())
    168     , m_editingAction(editingAction)
    169165    , m_propertyLevel(PropertyDefault)
    170166    , m_start(endingSelection().start().downstream())
     
    225221        break;
    226222    }
    227 }
    228 
    229 EditAction ApplyStyleCommand::editingAction() const
    230 {
    231     return m_editingAction;
    232223}
    233224
  • trunk/Source/WebCore/editing/ApplyStyleCommand.h

    r183283 r183368  
    7373
    7474    virtual void doApply() override;
    75     virtual EditAction editingAction() const override;
    7675
    7776    // style-removal helpers
     
    123122
    124123    RefPtr<EditingStyle> m_style;
    125     EditAction m_editingAction;
    126124    EPropertyLevel m_propertyLevel;
    127125    Position m_start;
  • trunk/Source/WebCore/editing/CompositeEditCommand.cpp

    r183283 r183368  
    5959#include "RenderText.h"
    6060#include "RenderedDocumentMarker.h"
     61#include "ReplaceDeleteFromTextNodeCommand.h"
     62#include "ReplaceInsertIntoTextNodeCommand.h"
    6163#include "ReplaceNodeWithSpanCommand.h"
    6264#include "ReplaceSelectionCommand.h"
     
    163165#endif
    164166
     167AXTextEditType EditCommandComposition::unapplyEditType() const
     168{
     169    switch (editingAction()) {
     170    case EditActionCut:
     171    case EditActionDelete:
     172        return AXTextEditTypeInsert;
     173    case EditActionDictation:
     174    case EditActionInsert:
     175    case EditActionPaste:
     176    case EditActionTyping:
     177        return AXTextEditTypeDelete;
     178    // Include default case for unhandled EditAction cases.
     179    default:
     180        break;
     181    }
     182    return AXTextEditTypeUnknown;
     183}
     184
    165185void applyCommand(PassRefPtr<CompositeEditCommand> command)
    166186{
     
    168188}
    169189
    170 CompositeEditCommand::CompositeEditCommand(Document& document)
    171     : EditCommand(document)
     190CompositeEditCommand::CompositeEditCommand(Document& document, EditAction editingAction)
     191    : EditCommand(document, editingAction)
    172192{
    173193}
     
    188208        case EditActionCut:
    189209        case EditActionUnspecified:
     210        case EditActionInsert:
    190211        case EditActionDelete:
    191212        case EditActionDictation:
     
    297318void CompositeEditCommand::insertParagraphSeparator(bool useDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea)
    298319{
    299     applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea));
     320    applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea, editingAction()));
    300321}
    301322
     
    323344void CompositeEditCommand::insertNodeBefore(PassRefPtr<Node> insertChild, PassRefPtr<Node> refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
    324345{
    325     applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChild, shouldAssumeContentIsAlwaysEditable));
     346    applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChild, shouldAssumeContentIsAlwaysEditable, editingAction()));
    326347}
    327348
     
    374395{
    375396    ASSERT(canHaveChildrenForEditing(parent.get()));
    376     applyCommandToComposite(AppendNodeCommand::create(parent, node));
     397    applyCommandToComposite(AppendNodeCommand::create(parent, node, editingAction()));
    377398}
    378399
     
    398419void CompositeEditCommand::removeNodePreservingChildren(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
    399420{
    400     applyCommandToComposite(RemoveNodePreservingChildrenCommand::create(node, shouldAssumeContentIsAlwaysEditable));
     421    applyCommandToComposite(RemoveNodePreservingChildrenCommand::create(node, shouldAssumeContentIsAlwaysEditable, editingAction()));
    401422}
    402423
     
    526547{
    527548    if (!text.isEmpty())
    528         applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, text));
     549        applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, text, editingAction()));
    529550}
    530551
    531552void CompositeEditCommand::deleteTextFromNode(PassRefPtr<Text> node, unsigned offset, unsigned count)
    532553{
    533     applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count));
     554    applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count, editingAction()));
    534555}
    535556
     
    537558{
    538559    RefPtr<Text> node(prpNode);
    539     applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count));
     560    RefPtr<DeleteFromTextNodeCommand> deleteCommand = ReplaceDeleteFromTextNodeCommand::create(WTF::move(node), offset, count);
     561    applyCommandToComposite(deleteCommand);
    540562    if (!replacementText.isEmpty())
    541         applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, replacementText));
     563        applyCommandToComposite(ReplaceInsertIntoTextNodeCommand::create(WTF::move(node), offset, replacementText, deleteCommand->deletedText(), editingAction()));
    542564}
    543565
     
    12901312    if (!preserveStyle)
    12911313        options |= ReplaceSelectionCommand::MatchStyle;
    1292     applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, options));
     1314    applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTF::move(fragment), options));
    12931315
    12941316    frame().editor().markMisspellingsAndBadGrammar(endingSelection());
  • trunk/Source/WebCore/editing/CompositeEditCommand.h

    r183283 r183368  
    6060#endif
    6161
     62    AXTextEditType unapplyEditType() const;
     63
    6264private:
    6365    EditCommandComposition(Document&, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, EditAction);
     
    9092
    9193protected:
    92     explicit CompositeEditCommand(Document&);
     94    explicit CompositeEditCommand(Document&, EditAction = EditActionUnspecified);
    9395
    9496    //
  • trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp

    r183283 r183368  
    11/*
    2  * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2008, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535namespace WebCore {
    3636
    37 DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(PassRefPtr<Text> node, unsigned offset, unsigned count)
    38     : SimpleEditCommand(node->document())
     37DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(RefPtr<Text>&& node, unsigned offset, unsigned count, EditAction editingAction)
     38    : SimpleEditCommand(node->document(), editingAction)
    3939    , m_node(node)
    4040    , m_offset(offset)
     
    5959   
    6060    // Need to notify this before actually deleting the text
    61     if (AXObjectCache* cache = document().existingAXObjectCache())
    62         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
     61    if (AXObjectCache::accessibilityEnabled())
     62        notifyAccessibilityForTextChange(m_node.get(), applyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
    6363
    6464    m_node->deleteData(m_offset, m_count, ec);
     
    7474    m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
    7575
    76     if (AXObjectCache* cache = document().existingAXObjectCache())
    77         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
     76    if (AXObjectCache::accessibilityEnabled())
     77        notifyAccessibilityForTextChange(m_node.get(), unapplyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
    7878}
    7979
  • trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h

    r183283 r183368  
    11/*
    2  * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2008, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535class DeleteFromTextNodeCommand : public SimpleEditCommand {
    3636public:
    37     static Ref<DeleteFromTextNodeCommand> create(PassRefPtr<Text> node, unsigned offset, unsigned count)
     37    static Ref<DeleteFromTextNodeCommand> create(RefPtr<Text>&& node, unsigned offset, unsigned count, EditAction editingAction = EditActionDelete)
    3838    {
    39         return adoptRef(*new DeleteFromTextNodeCommand(node, offset, count));
     39        return adoptRef(*new DeleteFromTextNodeCommand(WTF::move(node), offset, count, editingAction));
    4040    }
    4141
     42    const String& deletedText();
     43
     44protected:
     45    DeleteFromTextNodeCommand(RefPtr<Text>&&, unsigned offset, unsigned count, EditAction);
     46
    4247private:
    43     DeleteFromTextNodeCommand(PassRefPtr<Text>, unsigned offset, unsigned count);
    44 
    4548    virtual void doApply() override;
    4649    virtual void doUnapply() override;
     
    5659};
    5760
     61inline const String& DeleteFromTextNodeCommand::deletedText()
     62{
     63    return m_text;
     64}
     65
    5866} // namespace WebCore
    5967
  • trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp

    r183283 r183368  
    7373}
    7474
    75 DeleteSelectionCommand::DeleteSelectionCommand(Document& document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
    76     : CompositeEditCommand(document)
     75DeleteSelectionCommand::DeleteSelectionCommand(Document& document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup, EditAction editingAction)
     76    : CompositeEditCommand(document, editingAction)
    7777    , m_hasSelectionToDelete(false)
    7878    , m_smartDelete(smartDelete)
     
    9191}
    9292
    93 DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
    94     : CompositeEditCommand(selection.start().anchorNode()->document())
     93DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup, EditAction editingAction)
     94    : CompositeEditCommand(selection.start().anchorNode()->document(), editingAction)
    9595    , m_hasSelectionToDelete(true)
    9696    , m_smartDelete(smartDelete)
     
    885885}
    886886
    887 EditAction DeleteSelectionCommand::editingAction() const
    888 {
    889     // Note that DeleteSelectionCommand is also used when the user presses the Delete key,
    890     // but in that case there's a TypingCommand that supplies the editingAction(), so
    891     // the Undo menu correctly shows "Undo Typing"
    892     return EditActionCut;
    893 }
    894 
    895887// Normally deletion doesn't preserve the typing style that was present before it.  For example,
    896888// type a character, Bold, then delete the character and start typing.  The Bold typing style shouldn't
  • trunk/Source/WebCore/editing/DeleteSelectionCommand.h

    r183283 r183368  
    3535class DeleteSelectionCommand : public CompositeEditCommand {
    3636public:
    37     static Ref<DeleteSelectionCommand> create(Document& document, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false, bool sanitizeMarkup = true)
     37    static Ref<DeleteSelectionCommand> create(Document& document, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false, bool sanitizeMarkup = true, EditAction editingAction = EditActionDelete)
    3838    {
    39         return adoptRef(*new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup));
     39        return adoptRef(*new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup, editingAction));
    4040    }
    41     static Ref<DeleteSelectionCommand> create(const VisibleSelection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false, bool sanitizeMarkup = true)
     41    static Ref<DeleteSelectionCommand> create(const VisibleSelection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false, bool sanitizeMarkup = true, EditAction editingAction = EditActionDelete)
    4242    {
    43         return adoptRef(*new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup));
     43        return adoptRef(*new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup, editingAction));
    4444    }
    4545
    4646protected:
    47     DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool santizeMarkup);
     47    DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool santizeMarkup, EditAction = EditActionDelete);
    4848
    4949private:
    50     DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup);
     50    DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup, EditAction);
    5151
    5252    virtual void doApply();
    53     virtual EditAction editingAction() const;
    5453   
    5554    virtual bool preservesTypingStyle() const;
  • trunk/Source/WebCore/editing/DictationCommand.cpp

    r183283 r183368  
    116116    Vector<DictationAlternative> alternativesInLine;
    117117    collectDictationAlternativesInRange(lineStart, lineLength, alternativesInLine);
    118     RefPtr<InsertTextCommand> command = InsertTextCommand::createWithMarkerSupplier(document(), m_textToInsert.substring(lineStart, lineLength), DictationMarkerSupplier::create(alternativesInLine));
     118    RefPtr<InsertTextCommand> command = InsertTextCommand::createWithMarkerSupplier(document(), m_textToInsert.substring(lineStart, lineLength), DictationMarkerSupplier::create(alternativesInLine), EditActionDictation);
    119119    applyCommandToComposite(command, endingSelection());
    120120}
     
    125125        return;
    126126
    127     applyCommandToComposite(InsertParagraphSeparatorCommand::create(document()));
     127    applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), false, false, EditActionDictation));
    128128}
    129129
  • trunk/Source/WebCore/editing/EditAction.h

    r183283 r183368  
    3030    typedef enum {
    3131        EditActionUnspecified,
     32        EditActionInsert,
    3233        EditActionSetColor,
    3334        EditActionSetBackgroundColor,
  • trunk/Source/WebCore/editing/EditCommand.cpp

    r183283 r183368  
    2727#include "EditCommand.h"
    2828
     29#include "AXObjectCache.h"
    2930#include "CompositeEditCommand.h"
    3031#include "Document.h"
     
    3839namespace WebCore {
    3940
    40 EditCommand::EditCommand(Document& document)
     41EditCommand::EditCommand(Document& document, EditAction editingAction)
    4142    : m_document(document)
    4243    , m_parent(0)
     44    , m_editingAction(editingAction)
    4345{
    4446    ASSERT(document.frame());
     
    6870EditAction EditCommand::editingAction() const
    6971{
    70     return EditActionUnspecified;
     72    return m_editingAction;
    7173}
    7274
     
    113115}
    114116
     117AXTextEditType EditCommand::applyEditType() const
     118{
     119    switch (editingAction()) {
     120    case EditActionCut:
     121        return AXTextEditTypeCut;
     122    case EditActionDelete:
     123        return AXTextEditTypeDelete;
     124    case EditActionDictation:
     125        return AXTextEditTypeDictation;
     126    case EditActionInsert:
     127        return AXTextEditTypeInsert;
     128    case EditActionPaste:
     129        return AXTextEditTypePaste;
     130    case EditActionTyping:
     131        return AXTextEditTypeTyping;
     132    // Include default case for unhandled EditAction cases.
     133    default:
     134        break;
     135    }
     136    return AXTextEditTypeUnknown;
     137}
     138
     139AXTextEditType EditCommand::unapplyEditType() const
     140{
     141    switch (applyEditType()) {
     142    case AXTextEditTypeUnknown:
     143        return AXTextEditTypeUnknown;
     144    case AXTextEditTypeDelete:
     145    case AXTextEditTypeCut:
     146        return AXTextEditTypeInsert;
     147    case AXTextEditTypeInsert:
     148    case AXTextEditTypeTyping:
     149    case AXTextEditTypeDictation:
     150    case AXTextEditTypePaste:
     151        return AXTextEditTypeDelete;
     152    }
     153    return AXTextEditTypeUnknown;
     154}
     155
     156SimpleEditCommand::SimpleEditCommand(Document& document, EditAction editingAction)
     157    : EditCommand(document, editingAction)
     158{
     159}
     160
    115161void SimpleEditCommand::doReapply()
    116162{
     
    126172#endif
    127173
     174void SimpleEditCommand::notifyAccessibilityForTextChange(Node* node, AXTextEditType type, const String& text, const VisiblePosition& position)
     175{
     176    if (!AXObjectCache::accessibilityEnabled())
     177        return;
     178    AXObjectCache* cache = document().existingAXObjectCache();
     179    if (!cache)
     180        return;
     181    cache->postTextStateChangeNotification(node, type, text, position);
     182}
     183
    128184} // namespace WebCore
  • trunk/Source/WebCore/editing/EditCommand.h

    r183283 r183368  
    2727#define EditCommand_h
    2828
     29#include "AXTextStateChangeIntent.h"
    2930#include "EditAction.h"
    3031#include "VisibleSelection.h"
     
    4748    void setParent(CompositeEditCommand*);
    4849
    49     virtual EditAction editingAction() const;
     50    EditAction editingAction() const;
    5051
    5152    const VisibleSelection& startingSelection() const { return m_startingSelection; }
     
    6061    virtual void doApply() = 0;
    6162
     63    AXTextEditType applyEditType() const;
     64    AXTextEditType unapplyEditType() const;
     65
    6266protected:
    63     explicit EditCommand(Document&);
     67    explicit EditCommand(Document&, EditAction = EditActionUnspecified);
    6468    EditCommand(Document&, const VisibleSelection&, const VisibleSelection&);
    6569
     
    7579    VisibleSelection m_endingSelection;
    7680    CompositeEditCommand* m_parent;
     81    EditAction m_editingAction { EditActionUnspecified };
    7782};
    7883
     
    9297
    9398protected:
    94     explicit SimpleEditCommand(Document& document) : EditCommand(document) { }
     99    explicit SimpleEditCommand(Document&, EditAction = EditActionUnspecified);
    95100
    96101#ifndef NDEBUG
    97102    void addNodeAndDescendants(Node*, HashSet<Node*>&);
    98103#endif
     104
     105    virtual void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&);
    99106
    100107private:
  • trunk/Source/WebCore/editing/EditingAllInOne.cpp

    r183283 r183368  
    6060#include <RemoveNodePreservingChildrenCommand.cpp>
    6161#include <RenderedPosition.cpp>
     62#include <ReplaceDeleteFromTextNodeCommand.cpp>
     63#include <ReplaceInsertIntoTextNodeCommand.cpp>
    6264#include <ReplaceNodeWithSpanCommand.cpp>
    6365#include <ReplaceSelectionCommand.cpp>
  • trunk/Source/WebCore/editing/Editor.cpp

    r183283 r183368  
    209209                return true;
    210210#endif
    211             replaceSelectionWithFragment(event->pastingFragment(), false, event->shouldSmartReplace(), event->shouldMatchStyle(), event->mailBlockquoteHandling());
     211            replaceSelectionWithFragment(event->pastingFragment(), false, event->shouldSmartReplace(), event->shouldMatchStyle(), EditActionPaste, event->mailBlockquoteHandling());
    212212#if PLATFORM(IOS)
    213213        }
    214214#endif
    215215        else
    216             replaceSelectionWithText(event->data(), false, event->shouldSmartReplace());
     216            replaceSelectionWithText(event->data(), false, event->shouldSmartReplace(), EditActionPaste);
    217217        return true;
    218218    }
     
    375375}
    376376
    377 void Editor::deleteSelectionWithSmartDelete(bool smartDelete)
     377void Editor::deleteSelectionWithSmartDelete(bool smartDelete, EditAction editingAction)
    378378{
    379379    if (m_frame.selection().isNone())
    380380        return;
    381381
    382     applyCommand(DeleteSelectionCommand::create(document(), smartDelete));
     382    applyCommand(DeleteSelectionCommand::create(document(), smartDelete, true, false, false, true, editingAction));
    383383}
    384384
     
    521521}
    522522
    523 void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle, MailBlockquoteHandling mailBlockquoteHandling)
     523void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle, EditAction editingAction, MailBlockquoteHandling mailBlockquoteHandling)
    524524{
    525525    VisibleSelection selection = m_frame.selection().selection();
     
    537537        options |= ReplaceSelectionCommand::IgnoreMailBlockquote;
    538538
    539     applyCommand(ReplaceSelectionCommand::create(document(), fragment, options, EditActionPaste));
     539    applyCommand(ReplaceSelectionCommand::create(document(), fragment, options, editingAction));
    540540    revealSelectionAfterEditingOperation();
    541541
     
    551551}
    552552
    553 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace)
     553void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace, EditAction editingAction)
    554554{
    555555    RefPtr<Range> range = selectedRange();
     
    557557        return;
    558558
    559     replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, true);
     559    replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, true, editingAction);
    560560}
    561561
     
    999999    // Don't clear the typing style with this selection change.  We do those things elsewhere if necessary.
    10001000    FrameSelection::SetSelectionOptions options = cmd->isDictationCommand() ? FrameSelection::DictationTriggered : 0;
    1001     changeSelectionAfterCommand(newSelection, options);
     1001   
     1002    changeSelectionAfterCommand(newSelection, options, cmd->applyEditType());
    10021003    dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
    10031004
     
    10301031
    10311032    VisibleSelection newSelection(cmd->startingSelection());
    1032     changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions());
     1033    changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions(), cmd->unapplyEditType());
    10331034    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
    10341035
     
    12641265    didWriteSelectionToPasteboard();
    12651266    if (action == CutAction)
    1266         deleteSelectionWithSmartDelete(canSmartCopyOrDelete());
     1267        deleteSelectionWithSmartDelete(canSmartCopyOrDelete(), EditActionCut);
    12671268}
    12681269
     
    22362237        if (!m_frame.editor().shouldInsertText(autocorrectedString, misspellingRange.get(), EditorInsertActionTyped))
    22372238            return;
    2238         m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false);
     2239        m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false, EditActionInsert);
    22392240
    22402241        // Reset the charet one character further.
     
    25822583    m_alternativeTextController->recordAutocorrectionResponseReversed(replacedString, selection);
    25832584    TextCheckingParagraph paragraph(selection);
    2584     replaceSelectionWithText(replacedString, false, false);
     2585    replaceSelectionWithText(replacedString, false, false, EditActionInsert);
    25852586    RefPtr<Range> changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length());
    25862587    changedRange->startContainer()->document().markers().addMarker(changedRange.get(), DocumentMarker::Replacement, String());
     
    28162817    if (!shouldInsertText(transposed, range.get(), EditorInsertActionTyped))
    28172818        return;
    2818     replaceSelectionWithText(transposed, false, false);
     2819    replaceSelectionWithText(transposed, false, false, EditActionInsert);
    28192820}
    28202821
     
    28482849}
    28492850
    2850 void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection,  FrameSelection::SetSelectionOptions options)
     2851void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions options, AXTextStateChangeIntent intent)
    28512852{
    28522853    // If the new selection is orphaned, then don't update the selection.
     
    28602861    bool selectionDidNotChangeDOMPosition = newSelection == m_frame.selection().selection();
    28612862    if (selectionDidNotChangeDOMPosition || m_frame.selection().shouldChangeSelection(newSelection))
    2862         m_frame.selection().setSelection(newSelection, options);
     2863        m_frame.selection().setSelection(newSelection, options, intent);
    28632864
    28642865    // Some editing operations change the selection visually without affecting its position within the DOM.
  • trunk/Source/WebCore/editing/Editor.h

    r183283 r183368  
    175175
    176176    WEBCORE_EXPORT bool deleteWithDirection(SelectionDirection, TextGranularity, bool killRing, bool isTypingAction);
    177     WEBCORE_EXPORT void deleteSelectionWithSmartDelete(bool smartDelete);
     177    WEBCORE_EXPORT void deleteSelectionWithSmartDelete(bool smartDelete, EditAction = EditActionDelete);
    178178    void clearText();
    179179#if PLATFORM(IOS)
     
    383383    WEBCORE_EXPORT WritingDirection baseWritingDirectionForSelectionStart() const;
    384384
    385     WEBCORE_EXPORT void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
    386     WEBCORE_EXPORT void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace);
     385    WEBCORE_EXPORT void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle, EditAction = EditActionInsert, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
     386    WEBCORE_EXPORT void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace, EditAction = EditActionInsert);
    387387    WEBCORE_EXPORT bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const;
    388388    void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection);
     
    469469    void setComposition(const String&, SetCompositionMode);
    470470
    471     void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions);
     471    void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions, AXTextStateChangeIntent = AXTextStateChangeIntent());
    472472
    473473    enum EditorActionSpecifier { CutAction, CopyAction };
  • trunk/Source/WebCore/editing/EditorCommand.cpp

    r183283 r183368  
    193193{
    194194    ASSERT(frame.document());
    195     applyCommand(ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectionCommand::PreventNesting, EditActionUnspecified));
     195    applyCommand(ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectionCommand::PreventNesting, EditActionInsert));
    196196    return true;
    197197}
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r183283 r183368  
    2727#include "FrameSelection.h"
    2828
     29#include "AXObjectCache.h"
    2930#include "CharacterData.h"
    3031#include "DeleteSelectionCommand.h"
     
    140141{
    141142    setSelection(VisibleSelection(pos.deepEquivalent(), pos.deepEquivalent(), pos.affinity(), m_selection.isDirectional()),
    142         defaultSetSelectionOptions(userTriggered), align);
     143        defaultSetSelectionOptions(userTriggered), AXTextStateChangeIntent(), align);
    143144}
    144145
     
    171172    newSelection.setWithoutValidation(base, extent);
    172173    newSelection.setIsDirectional(selectionHasDirection);
    173     setSelection(newSelection, defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus));
     174    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
     175    setSelection(newSelection, defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus), intent);
    174176}
    175177
     
    255257        return;
    256258
    257     setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, AlignCursorOnScrollIfNeeded, granularity);
     259   
     260    AXTextStateChangeIntent intent;
     261    if (AXObjectCache::accessibilityEnabled() && newSelection.isCaret())
     262        intent = AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
     263    else
     264        intent = AXTextStateChangeIntent();
     265    setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent, AlignCursorOnScrollIfNeeded, granularity);
    258266}
    259267
     
    277285        if (RefPtr<Frame> newSelectionFrame = newSelectionDocument->frame()) {
    278286            if (newSelectionFrame != m_frame && newSelectionDocument != m_frame->document()) {
    279                 newSelectionFrame->selection().setSelection(newSelection, options, align, granularity);
     287                newSelectionFrame->selection().setSelection(newSelection, options, AXTextStateChangeIntent(), align, granularity);
    280288                // It's possible that during the above set selection, this FrameSelection has been modified by
    281289                // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since
     
    321329}
    322330
    323 void FrameSelection::setSelection(const VisibleSelection& selection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
     331void FrameSelection::setSelection(const VisibleSelection& selection, SetSelectionOptions options, AXTextStateChangeIntent intent, CursorAlignOnScroll align, TextGranularity granularity)
    324332{
    325333    if (!setSelectionWithoutUpdatingAppearance(selection, options, align, granularity))
     
    342350        return;
    343351
    344     updateAndRevealSelection();
     352    updateAndRevealSelection(intent);
    345353}
    346354
     
    361369}
    362370
    363 void FrameSelection::updateAndRevealSelection()
     371void FrameSelection::updateAndRevealSelection(const AXTextStateChangeIntent& intent)
    364372{
    365373    if (!m_pendingSelectionUpdate)
     
    381389    }
    382390
    383     notifyAccessibilityForSelectionChange();
     391    notifyAccessibilityForSelectionChange(intent);
    384392
    385393    if (auto* client = m_frame->editor().client())
     
    10221030{
    10231031    return granularity == LineBoundary || granularity == ParagraphBoundary || granularity == DocumentBoundary;
    1024 }   
     1032}
     1033
     1034AXTextStateChangeIntent FrameSelection::textSelectionIntent(EAlteration alter, SelectionDirection direction, TextGranularity granularity)
     1035{
     1036    AXTextStateChangeIntent intent = AXTextStateChangeIntent();
     1037    bool flip = false;
     1038    if (alter == FrameSelection::AlterationMove) {
     1039        intent.type = AXTextStateChangeTypeSelectionMove;
     1040        flip = isRange() && directionOfSelection() == RTL;
     1041    } else
     1042        intent.type = AXTextStateChangeTypeSelectionExtend;
     1043    switch (granularity) {
     1044    case CharacterGranularity:
     1045        intent.selection.granularity = AXTextSelectionGranularityCharacter;
     1046        break;
     1047    case WordGranularity:
     1048        intent.selection.granularity = AXTextSelectionGranularityWord;
     1049        break;
     1050    case SentenceGranularity:
     1051    case SentenceBoundary:
     1052        intent.selection.granularity = AXTextSelectionGranularitySentence;
     1053        break;
     1054    case LineGranularity:
     1055    case LineBoundary:
     1056        intent.selection.granularity = AXTextSelectionGranularityLine;
     1057        break;
     1058    case ParagraphGranularity:
     1059    case ParagraphBoundary:
     1060        intent.selection.granularity = AXTextSelectionGranularityParagraph;
     1061        break;
     1062    case DocumentGranularity:
     1063    case DocumentBoundary:
     1064        intent.selection.granularity = AXTextSelectionGranularityDocument;
     1065        break;
     1066    }
     1067    bool boundary = false;
     1068    switch (granularity) {
     1069    case CharacterGranularity:
     1070    case WordGranularity:
     1071    case SentenceGranularity:
     1072    case LineGranularity:
     1073    case ParagraphGranularity:
     1074    case DocumentGranularity:
     1075        break;
     1076    case SentenceBoundary:
     1077    case LineBoundary:
     1078    case ParagraphBoundary:
     1079    case DocumentBoundary:
     1080        boundary = true;
     1081        break;
     1082    }
     1083    switch (direction) {
     1084    case DirectionRight:
     1085    case DirectionForward:
     1086        if (boundary)
     1087            intent.selection.direction = flip ? AXTextSelectionDirectionBeginning : AXTextSelectionDirectionEnd;
     1088        else
     1089            intent.selection.direction = flip ? AXTextSelectionDirectionPrevious : AXTextSelectionDirectionNext;
     1090        break;
     1091    case DirectionLeft:
     1092    case DirectionBackward:
     1093        if (boundary)
     1094            intent.selection.direction = flip ? AXTextSelectionDirectionEnd : AXTextSelectionDirectionBeginning;
     1095        else
     1096            intent.selection.direction = flip ? AXTextSelectionDirectionNext : AXTextSelectionDirectionPrevious;
     1097        break;
     1098    }
     1099    return intent;
     1100}
    10251101
    10261102bool FrameSelection::modify(EAlteration alter, SelectionDirection direction, TextGranularity granularity, EUserTriggered userTriggered)
     
    10771153        if (!wasRange && alter == AlterationMove && position == originalStartPosition)
    10781154            return false;
     1155
     1156    if (m_frame && AXObjectCache::accessibilityEnabled()) {
     1157        if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache())
     1158            cache->setTextSelectionIntent(textSelectionIntent(alter, direction, granularity));
     1159    }
    10791160
    10801161    // Some of the above operations set an xPosForVerticalArrowNavigation.
     
    17111792    VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(root.get()));
    17121793
    1713     if (shouldChangeSelection(newSelection))
    1714         setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent);
     1794    if (shouldChangeSelection(newSelection)) {
     1795        AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionExtend, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityAll });
     1796        setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent);
     1797    }
    17151798}
    17161799
     
    21462229{
    21472230    setCaretRectNeedsUpdate();
    2148     updateAndRevealSelection();
     2231    updateAndRevealSelection(AXTextStateChangeIntent());
    21492232    updateDataDetectorsForSelection();
    21502233}
     
    24242507    VisibleSelection newSelection = frameSelection.selection();
    24252508    newSelection.expandUsingGranularity(WordGranularity);
    2426     frameSelection.setSelection(newSelection, defaultSetSelectionOptions(), AlignCursorOnScrollIfNeeded, frameSelection.granularity());
     2509    frameSelection.setSelection(newSelection, defaultSetSelectionOptions(), AXTextStateChangeIntent(), AlignCursorOnScrollIfNeeded, frameSelection.granularity());
    24272510
    24282511    Position startPos(frameSelection.selection().start());
  • trunk/Source/WebCore/editing/FrameSelection.h

    r183283 r183368  
    2727#define FrameSelection_h
    2828
     29#include "AXTextStateChangeIntent.h"
    2930#include "EditingStyle.h"
    3031#include "IntRect.h"
     
    145146
    146147    const VisibleSelection& selection() const { return m_selection; }
    147     WEBCORE_EXPORT void setSelection(const VisibleSelection&, SetSelectionOptions = defaultSetSelectionOptions(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
     148    WEBCORE_EXPORT void setSelection(const VisibleSelection&, SetSelectionOptions = defaultSetSelectionOptions(), AXTextStateChangeIntent = AXTextStateChangeIntent(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
    148149    WEBCORE_EXPORT bool setSelectedRange(Range*, EAffinity, bool closeTyping);
    149150    WEBCORE_EXPORT void selectAll();
     
    273274    enum EPositionType { START, END, BASE, EXTENT };
    274275
    275     void updateAndRevealSelection();
     276    void updateAndRevealSelection(const AXTextStateChangeIntent&);
    276277    void updateDataDetectorsForSelection();
    277278
     
    298299    LayoutUnit lineDirectionPointForBlockDirectionNavigation(EPositionType);
    299300
     301    AXTextStateChangeIntent textSelectionIntent(EAlteration, SelectionDirection, TextGranularity);
    300302#if HAVE(ACCESSIBILITY)
    301     void notifyAccessibilityForSelectionChange();
     303    void notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&);
    302304#else
    303     void notifyAccessibilityForSelectionChange() { }
     305    void notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&) { }
    304306#endif
    305307
     
    368370#if !(PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(EFL))
    369371#if HAVE(ACCESSIBILITY)
    370 inline void FrameSelection::notifyAccessibilityForSelectionChange()
     372inline void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&)
    371373{
    372374}
  • trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp

    r183283 r183368  
    4040namespace WebCore {
    4141
    42 InsertIntoTextNodeCommand::InsertIntoTextNodeCommand(PassRefPtr<Text> node, unsigned offset, const String& text)
    43     : SimpleEditCommand(node->document())
     42InsertIntoTextNodeCommand::InsertIntoTextNodeCommand(RefPtr<Text>&& node, unsigned offset, const String& text, EditAction editingAction)
     43    : SimpleEditCommand(node->document(), editingAction)
    4444    , m_node(node)
    4545    , m_offset(offset)
     
    6767    m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
    6868
    69     if (AXObjectCache* cache = document().existingAXObjectCache())
    70         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
     69    if (AXObjectCache::accessibilityEnabled())
     70        notifyAccessibilityForTextChange(m_node.get(), applyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
    7171}
    7272
     
    8585       
    8686    // Need to notify this before actually deleting the text
    87     if (AXObjectCache* cache = document().existingAXObjectCache())
    88         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
     87    if (AXObjectCache::accessibilityEnabled())
     88        notifyAccessibilityForTextChange(m_node.get(), unapplyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
    8989
    9090    m_node->deleteData(m_offset, m_text.length(), IGNORE_EXCEPTION);
  • trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h

    r183283 r183368  
    3535class InsertIntoTextNodeCommand : public SimpleEditCommand {
    3636public:
    37     static Ref<InsertIntoTextNodeCommand> create(PassRefPtr<Text> node, unsigned offset, const String& text)
     37    static Ref<InsertIntoTextNodeCommand> create(RefPtr<Text>&& node, unsigned offset, const String& text, EditAction editingAction = EditActionInsert)
    3838    {
    39         return adoptRef(*new InsertIntoTextNodeCommand(node, offset, text));
     39        return adoptRef(*new InsertIntoTextNodeCommand(WTF::move(node), offset, text, editingAction));
    4040    }
    4141
     42    const String& insertedText();
     43
     44protected:
     45    InsertIntoTextNodeCommand(RefPtr<Text>&& node, unsigned offset, const String& text, EditAction editingAction);
     46
    4247private:
    43     InsertIntoTextNodeCommand(PassRefPtr<Text> node, unsigned offset, const String& text);
    44 
    4548    virtual void doApply() override;
    4649    virtual void doUnapply() override;
     
    5861};
    5962
     63inline const String& InsertIntoTextNodeCommand::insertedText()
     64{
     65    return m_text;
     66}
     67
    6068} // namespace WebCore
    6169
  • trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp

    r183283 r183368  
    3030#include "Document.h"
    3131#include "ExceptionCodePlaceholder.h"
     32#include "Text.h"
    3233#include "htmlediting.h"
    3334
    3435namespace WebCore {
    3536
    36 InsertNodeBeforeCommand::InsertNodeBeforeCommand(PassRefPtr<Node> insertChild, PassRefPtr<Node> refChild,
    37     ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
    38     : SimpleEditCommand(refChild->document())
     37InsertNodeBeforeCommand::InsertNodeBeforeCommand(RefPtr<Node>&& insertChild, RefPtr<Node>&& refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction)
     38    : SimpleEditCommand(refChild->document(), editingAction)
    3939    , m_insertChild(insertChild)
    4040    , m_refChild(refChild)
     
    5858    parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION);
    5959
    60     if (AXObjectCache* cache = document().existingAXObjectCache())
    61         cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue());
     60    if (AXObjectCache::accessibilityEnabled()) {
     61        Position position = is<Text>(m_insertChild.get()) ? Position(downcast<Text>(m_insertChild.get()), 0) : createLegacyEditingPosition(m_insertChild.get(), 0);
     62        notifyAccessibilityForTextChange(m_insertChild.get(), applyEditType(), m_insertChild->nodeValue(), VisiblePosition(position));
     63    }
    6264}
    6365
     
    6870
    6971    // Need to notify this before actually deleting the text
    70     if (AXObjectCache* cache = document().existingAXObjectCache())
    71         cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue());
     72    if (AXObjectCache::accessibilityEnabled()) {
     73        Position position = is<Text>(m_insertChild.get()) ? Position(downcast<Text>(m_insertChild.get()), 0) : createLegacyEditingPosition(m_insertChild.get(), 0);
     74        notifyAccessibilityForTextChange(m_insertChild.get(), unapplyEditType(), m_insertChild->nodeValue(), VisiblePosition(position));
     75    }
    7276
    7377    m_insertChild->remove(IGNORE_EXCEPTION);
  • trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h

    r183283 r183368  
    3333class InsertNodeBeforeCommand : public SimpleEditCommand {
    3434public:
    35     static Ref<InsertNodeBeforeCommand> create(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore,
    36         ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
     35    static Ref<InsertNodeBeforeCommand> create(RefPtr<Node>&& childToInsert, RefPtr<Node>&& childToInsertBefore,
     36        ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction = EditActionInsert)
    3737    {
    38         return adoptRef(*new InsertNodeBeforeCommand(childToInsert, childToInsertBefore, shouldAssumeContentIsAlwaysEditable));
     38        return adoptRef(*new InsertNodeBeforeCommand(WTF::move(childToInsert), WTF::move(childToInsertBefore), shouldAssumeContentIsAlwaysEditable, editingAction));
    3939    }
    4040
     41protected:
     42    InsertNodeBeforeCommand(RefPtr<Node>&& childToInsert, RefPtr<Node>&& childToInsertBefore, ShouldAssumeContentIsAlwaysEditable, EditAction);
     43
    4144private:
    42     InsertNodeBeforeCommand(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore, ShouldAssumeContentIsAlwaysEditable);
    43 
    4445    virtual void doApply() override;
    4546    virtual void doUnapply() override;
    46    
     47
    4748#ifndef NDEBUG
    4849    virtual void getNodesInCommand(HashSet<Node*>&) override;
    4950#endif
    50    
     51
    5152    RefPtr<Node> m_insertChild;
    5253    RefPtr<Node> m_refChild;
  • trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp

    r183283 r183368  
    6060}
    6161
    62 InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document& document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea)
    63     : CompositeEditCommand(document)
     62InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document& document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea, EditAction editingAction)
     63    : CompositeEditCommand(document, editingAction)
    6464    , m_mustUseDefaultParagraphElement(mustUseDefaultParagraphElement)
    6565    , m_pasteBlockqutoeIntoUnquotedArea(pasteBlockqutoeIntoUnquotedArea)
  • trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.h

    r183283 r183368  
    3535class InsertParagraphSeparatorCommand : public CompositeEditCommand {
    3636public:
    37     static Ref<InsertParagraphSeparatorCommand> create(Document& document, bool useDefaultParagraphElement = false, bool pasteBlockqutoeIntoUnquotedArea = false)
     37    static Ref<InsertParagraphSeparatorCommand> create(Document& document, bool useDefaultParagraphElement = false, bool pasteBlockqutoeIntoUnquotedArea = false, EditAction editingAction = EditActionInsert)
    3838    {
    39         return adoptRef(*new InsertParagraphSeparatorCommand(document, useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea));
     39        return adoptRef(*new InsertParagraphSeparatorCommand(document, useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea, editingAction));
    4040    }
    4141
    4242private:
    43     InsertParagraphSeparatorCommand(Document&, bool useDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea);
     43    InsertParagraphSeparatorCommand(Document&, bool useDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea, EditAction);
    4444
    4545    virtual void doApply();
  • trunk/Source/WebCore/editing/InsertTextCommand.cpp

    r183283 r183368  
    3838namespace WebCore {
    3939
    40 InsertTextCommand::InsertTextCommand(Document& document, const String& text, bool selectInsertedText, RebalanceType rebalanceType)
    41     : CompositeEditCommand(document)
     40InsertTextCommand::InsertTextCommand(Document& document, const String& text, bool selectInsertedText, RebalanceType rebalanceType, EditAction editingAction)
     41    : CompositeEditCommand(document, editingAction)
    4242    , m_text(text)
    4343    , m_selectInsertedText(selectInsertedText)
     
    4646}
    4747
    48 InsertTextCommand::InsertTextCommand(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier)
    49     : CompositeEditCommand(document)
     48InsertTextCommand::InsertTextCommand(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier, EditAction editingAction)
     49    : CompositeEditCommand(document, editingAction)
    5050    , m_text(text)
    5151    , m_selectInsertedText(false)
  • trunk/Source/WebCore/editing/InsertTextCommand.h

    r183283 r183368  
    5050
    5151    static Ref<InsertTextCommand> create(Document& document, const String& text, bool selectInsertedText = false,
    52         RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces)
     52        RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces, EditAction editingAction = EditActionInsert)
    5353    {
    54         return adoptRef(*new InsertTextCommand(document, text, selectInsertedText, rebalanceType));
     54        return adoptRef(*new InsertTextCommand(document, text, selectInsertedText, rebalanceType, editingAction));
    5555    }
    5656
    57     static Ref<InsertTextCommand> createWithMarkerSupplier(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier)
     57    static Ref<InsertTextCommand> createWithMarkerSupplier(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier, EditAction editingAction = EditActionInsert)
    5858    {
    59         return adoptRef(*new InsertTextCommand(document, text, markerSupplier));
     59        return adoptRef(*new InsertTextCommand(document, text, markerSupplier, editingAction));
    6060    }
    6161
     62protected:
     63    InsertTextCommand(Document&, const String& text, PassRefPtr<TextInsertionMarkerSupplier>, EditAction);
     64    InsertTextCommand(Document&, const String& text, bool selectInsertedText, RebalanceType, EditAction);
     65
    6266private:
    63 
    64     InsertTextCommand(Document&, const String& text, bool selectInsertedText, RebalanceType);
    65     InsertTextCommand(Document&, const String& text, PassRefPtr<TextInsertionMarkerSupplier>);
    6667
    6768    void deleteCharacter();
  • trunk/Source/WebCore/editing/MoveSelectionCommand.cpp

    r183283 r183368  
    8080    if (m_smartInsert)
    8181        options |= ReplaceSelectionCommand::SmartReplace;
    82     applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragment, options));
     82    applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTF::move(m_fragment), options));
    8383}
    8484
  • trunk/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp

    r183283 r183368  
    3232namespace WebCore {
    3333
    34 RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
    35     : CompositeEditCommand(node->document())
     34RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction)
     35    : CompositeEditCommand(node->document(), editingAction)
    3636    , m_node(node)
    3737    , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable)
  • trunk/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.h

    r183283 r183368  
    3333class RemoveNodePreservingChildrenCommand : public CompositeEditCommand {
    3434public:
    35     static Ref<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
     35    static Ref<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction)
    3636    {
    37         return adoptRef(*new RemoveNodePreservingChildrenCommand(node, shouldAssumeContentIsAlwaysEditable));
     37        return adoptRef(*new RemoveNodePreservingChildrenCommand(node, shouldAssumeContentIsAlwaysEditable, editingAction));
    3838    }
    3939
    4040private:
    41     explicit RemoveNodePreservingChildrenCommand(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable);
     41    explicit RemoveNodePreservingChildrenCommand(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable, EditAction);
    4242
    4343    virtual void doApply();
  • trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.cpp

    r183367 r183368  
    11/*
    2  * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef AppendNodeCommand_h
    27 #define AppendNodeCommand_h
     26#include "config.h"
     27#include "ReplaceDeleteFromTextNodeCommand.h"
    2828
    29 #include "EditCommand.h"
     29#include "Text.h"
    3030
    3131namespace WebCore {
     32   
     33ReplaceDeleteFromTextNodeCommand::ReplaceDeleteFromTextNodeCommand(RefPtr<Text>&& text, unsigned offset, unsigned count)
     34    : DeleteFromTextNodeCommand(WTF::move(text), offset, count, EditActionDelete)
     35{
     36}
    3237
    33 class AppendNodeCommand : public SimpleEditCommand {
    34 public:
    35     static Ref<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node)
    36     {
    37         return adoptRef(*new AppendNodeCommand(parent, node));
    38     }
    39 
    40 private:
    41     AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>);
    42 
    43     virtual void doApply() override;
    44     virtual void doUnapply() override;
    45 
    46 #ifndef NDEBUG
    47     virtual void getNodesInCommand(HashSet<Node*>&) override;
    48 #endif
    49 
    50     RefPtr<ContainerNode> m_parent;
    51     RefPtr<Node> m_node;
    52 };
     38void ReplaceDeleteFromTextNodeCommand::notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&)
     39{
     40}
    5341
    5442} // namespace WebCore
    55 
    56 #endif // AppendNodeCommand_h
  • trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.h

    r183367 r183368  
    11/*
    2  * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef AppendNodeCommand_h
    27 #define AppendNodeCommand_h
     26#ifndef ReplaceDeleteFromTextNodeCommand_h
     27#define ReplaceDeleteFromTextNodeCommand_h
    2828
    29 #include "EditCommand.h"
     29#include "DeleteFromTextNodeCommand.h"
    3030
    3131namespace WebCore {
    3232
    33 class AppendNodeCommand : public SimpleEditCommand {
     33class ReplaceDeleteFromTextNodeCommand final : public DeleteFromTextNodeCommand {
    3434public:
    35     static Ref<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node)
     35    static Ref<ReplaceDeleteFromTextNodeCommand> create(RefPtr<Text>&& text, unsigned offset, unsigned count)
    3636    {
    37         return adoptRef(*new AppendNodeCommand(parent, node));
     37        return adoptRef(*new ReplaceDeleteFromTextNodeCommand(WTF::move(text), offset, count));
    3838    }
    3939
    4040private:
    41     AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>);
    42 
    43     virtual void doApply() override;
    44     virtual void doUnapply() override;
    45 
    46 #ifndef NDEBUG
    47     virtual void getNodesInCommand(HashSet<Node*>&) override;
    48 #endif
    49 
    50     RefPtr<ContainerNode> m_parent;
    51     RefPtr<Node> m_node;
     41    ReplaceDeleteFromTextNodeCommand(RefPtr<Text>&&, unsigned, unsigned);
     42    virtual void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&) override;
    5243};
    5344
    5445} // namespace WebCore
    5546
    56 #endif // AppendNodeCommand_h
     47#endif // ReplaceDeleteFromTextNodeCommand_h
  • trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.h

    r183367 r183368  
    11/*
    2  * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef RemoveNodePreservingChildrenCommand_h
    27 #define RemoveNodePreservingChildrenCommand_h
     26#ifndef ReplaceInsertIntoTextNodeCommand_h
     27#define ReplaceInsertIntoTextNodeCommand_h
    2828
    29 #include "CompositeEditCommand.h"
     29#include "InsertIntoTextNodeCommand.h"
    3030
    3131namespace WebCore {
    3232
    33 class RemoveNodePreservingChildrenCommand : public CompositeEditCommand {
     33class ReplaceInsertIntoTextNodeCommand final : public InsertIntoTextNodeCommand {
    3434public:
    35     static Ref<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
     35    static Ref<ReplaceInsertIntoTextNodeCommand> create(RefPtr<Text>&& node, unsigned offset, const String& text, const String& deletedText, EditAction editingAction)
    3636    {
    37         return adoptRef(*new RemoveNodePreservingChildrenCommand(node, shouldAssumeContentIsAlwaysEditable));
     37        return adoptRef(*new ReplaceInsertIntoTextNodeCommand(WTF::move(node), offset, text, deletedText, editingAction));
    3838    }
    3939
    4040private:
    41     explicit RemoveNodePreservingChildrenCommand(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable);
     41    ReplaceInsertIntoTextNodeCommand(RefPtr<Text>&&, unsigned, const String&, const String&, EditAction);
     42    virtual void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&) override;
    4243
    43     virtual void doApply();
    44 
    45     RefPtr<Node> m_node;
    46     ShouldAssumeContentIsAlwaysEditable m_shouldAssumeContentIsAlwaysEditable;
     44    String m_deletedText;
    4745};
    4846
    4947} // namespace WebCore
    5048
    51 #endif // RemoveNodePreservingChildrenCommand_h
     49#endif // ReplaceInsertIntoTextNodeCommand_h
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r183283 r183368  
    4848#include "RenderObject.h"
    4949#include "RenderText.h"
     50#include "ReplaceDeleteFromTextNodeCommand.h"
     51#include "ReplaceInsertIntoTextNodeCommand.h"
    5052#include "SimplifyMarkupCommand.h"
    5153#include "SmartReplace.h"
     
    369371}
    370372
    371 ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, PassRefPtr<DocumentFragment> fragment, CommandOptions options, EditAction editAction)
    372     : CompositeEditCommand(document)
     373ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, RefPtr<DocumentFragment>&& fragment, CommandOptions options, EditAction editAction)
     374    : CompositeEditCommand(document, editAction)
    373375    , m_selectReplacement(options & SelectReplacement)
    374376    , m_smartReplace(options & SmartReplace)
     
    377379    , m_preventNesting(options & PreventNesting)
    378380    , m_movingParagraph(options & MovingParagraph)
    379     , m_editAction(editAction)
    380381    , m_sanitizeFragment(options & SanitizeFragment)
    381382    , m_shouldMergeEnd(false)
     
    14281429}
    14291430
    1430 EditAction ReplaceSelectionCommand::editingAction() const
    1431 {
    1432     return m_editAction;
    1433 }
    1434 
    14351431// If the user is inserting a list into an existing list, instead of nesting the list,
    14361432// we put the list items into the existing list.
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.h

    r183283 r183368  
    4949    typedef unsigned CommandOptions;
    5050
    51     static Ref<ReplaceSelectionCommand> create(Document& document, PassRefPtr<DocumentFragment> fragment, CommandOptions options, EditAction action = EditActionPaste)
     51    static Ref<ReplaceSelectionCommand> create(Document& document, RefPtr<DocumentFragment>&& fragment, CommandOptions options, EditAction editingAction = EditActionInsert)
    5252    {
    53         return adoptRef(*new ReplaceSelectionCommand(document, fragment, options, action));
     53        return adoptRef(*new ReplaceSelectionCommand(document, WTF::move(fragment), options, editingAction));
    5454    }
    5555
    5656private:
    57     ReplaceSelectionCommand(Document&, PassRefPtr<DocumentFragment>, CommandOptions, EditAction);
     57    ReplaceSelectionCommand(Document&, RefPtr<DocumentFragment>&&, CommandOptions, EditAction);
    5858
    5959    virtual void doApply();
    60     virtual EditAction editingAction() const;
    61    
     60
    6261    class InsertedNodes {
    6362    public:
     
    121120    bool m_preventNesting;
    122121    bool m_movingParagraph;
    123     EditAction m_editAction;
    124122    bool m_sanitizeFragment;
    125123    bool m_shouldMergeEnd;
  • trunk/Source/WebCore/editing/TypingCommand.cpp

    r183283 r183368  
    375375{
    376376    RefPtr<InsertTextCommand> command = InsertTextCommand::create(document(), text, selectInsertedText,
    377         m_compositionType == TextCompositionNone ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces : InsertTextCommand::RebalanceAllWhitespaces);
     377        m_compositionType == TextCompositionNone ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces : InsertTextCommand::RebalanceAllWhitespaces, EditActionTyping);
    378378
    379379    applyCommandToComposite(command, endingSelection());
     
    396396        return;
    397397
    398     applyCommandToComposite(InsertParagraphSeparatorCommand::create(document()));
     398    applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), false, false, EditActionTyping));
    399399    typingAddedToOpenCommand(InsertParagraphSeparator);
    400400}
  • trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp

    r183283 r183368  
    7979
    8080
    81 void FrameSelection::notifyAccessibilityForSelectionChange()
     81void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&)
    8282{
    8383    if (!AXObjectCache::accessibilityEnabled())
  • trunk/Source/WebCore/editing/ios/DictationCommandIOS.cpp

    r183283 r183368  
    3939
    4040DictationCommandIOS::DictationCommandIOS(Document& document, Vector<Vector<String>>&& dictationPhrases, RetainPtr<id> metadata)
    41     : CompositeEditCommand(document)
     41    : CompositeEditCommand(document, EditActionDictation)
    4242    , m_dictationPhrases(WTF::move(dictationPhrases))
    4343    , m_metadata(WTF::move(metadata))
  • trunk/Source/WebCore/editing/ios/DictationCommandIOS.h

    r183283 r183368  
    4545
    4646    virtual void doApply() override;
    47     virtual EditAction editingAction() const override { return EditActionDictation; }
    4847
    4948    Vector<Vector<String>> m_dictationPhrases;
  • trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm

    r183283 r183368  
    4848   
    4949   
    50 void FrameSelection::notifyAccessibilityForSelectionChange()
     50void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent& intent)
    5151{
    5252    Document* document = m_frame->document();
     
    5454    if (m_selection.start().isNotNull() && m_selection.end().isNotNull()) {
    5555        if (AXObjectCache* cache = document->existingAXObjectCache())
    56             cache->postNotification(m_selection.start().deprecatedNode()->renderer(), AXObjectCache::AXSelectedTextChanged, TargetObservableParent);
     56            cache->postTextStateChangeNotification(m_selection.start().deprecatedNode(), intent, m_selection);
    5757    }
    5858
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp

    r183283 r183368  
    549549
    550550    ASSERT(isTextFormControl());
    551     bool textIsChanged = value != innerTextValueFrom(*innerText);
     551    String previousValue = innerTextValueFrom(*innerText);
     552    bool textIsChanged = value != previousValue;
    552553    if (textIsChanged || !innerText->hasChildNodes()) {
     554#if HAVE(ACCESSIBILITY) && !PLATFORM(COCOA)
    553555        if (textIsChanged && renderer()) {
    554556            if (AXObjectCache* cache = document().existingAXObjectCache())
    555557                cache->postNotification(this, AXObjectCache::AXValueChanged, TargetObservableParent);
    556558        }
     559#endif
    557560        innerText->setInnerText(value, ASSERT_NO_EXCEPTION);
    558561
    559562        if (value.endsWith('\n') || value.endsWith('\r'))
    560563            innerText->appendChild(HTMLBRElement::create(document()), ASSERT_NO_EXCEPTION);
     564
     565#if HAVE(ACCESSIBILITY) && PLATFORM(COCOA)
     566        if (textIsChanged && renderer()) {
     567            if (AXObjectCache* cache = document().existingAXObjectCache())
     568                cache->postTextReplacementNotification(this, AXTextEditTypeDelete, previousValue, AXTextEditTypeInsert, value, VisiblePosition(Position(this, Position::PositionIsBeforeAnchor)));
     569        }
     570#endif
    561571    }
    562572
  • trunk/Source/WebCore/page/DragController.cpp

    r183283 r183368  
    525525                if (chosePlainText)
    526526                    options |= ReplaceSelectionCommand::MatchStyle;
    527                 applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse, fragment, options));
     527                applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse, WTF::move(fragment), options));
    528528            }
    529529        }
  • trunk/Source/WebCore/page/EventHandler.cpp

    r183283 r183368  
    32403240    }
    32413241
    3242     selection.setSelection(visiblePosition, FrameSelection::defaultSetSelectionOptions(UserTriggered));
     3242    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
     3243    selection.setSelection(visiblePosition, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent);
    32433244}
    32443245
  • trunk/Source/WebCore/page/FocusController.cpp

    r183283 r183368  
    341341        Position position = firstPositionInOrBeforeNode(element.get());
    342342        VisibleSelection newSelection(position, position, DOWNSTREAM);
    343         if (frame.selection().shouldChangeSelection(newSelection))
    344             frame.selection().setSelection(newSelection);
     343        if (frame.selection().shouldChangeSelection(newSelection)) {
     344            AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
     345            frame.selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent);
     346        }
    345347    }
    346348
  • trunk/Source/WebKit/mac/ChangeLog

    r183336 r183368  
     12015-04-26  Doug Russell  <d_russell@apple.com>
     2
     3        AX: richer text change notifications (142719)
     4        https://bugs.webkit.org/show_bug.cgi?id=142719
     5
     6        Reviewed by Darin Adler.
     7
     8        Richer accessibility value change notifications. Introduce AXTextEditType,
     9        postTextStateChangeNotification and postTextReplacementNotification to give assistive
     10        tech apps more reliable context for responding to changes in web content. Also implement
     11        a mechanism to post value changes in password form fields in coalesced ticks to thwart
     12        analyzing the cadence of changes.
     13
     14        Richer accessibility selection change notifications. Introduce AXTextStateChangeIntent,
     15        and an overload of postTextReplacementNotification to give assistive tech apps more
     16        reliable context for responding to changes in web content selection. Also block posting
     17        selection changes on password fields.
     18
     19        * WebCoreSupport/WebEditorClient.mm:
     20        (undoNameForEditAction):
     21
    1222015-04-24  Timothy Hatcher  <timothy@apple.com>
    223
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r183283 r183368  
    547547    switch (editAction) {
    548548        case EditActionUnspecified: return nil;
     549        case EditActionInsert: return nil;
    549550        case EditActionSetColor: return UI_STRING_KEY_INTERNAL("Set Color", "Set Color (Undo action name)", "Undo action name");
    550551        case EditActionSetBackgroundColor: return UI_STRING_KEY_INTERNAL("Set Background Color", "Set Background Color (Undo action name)", "Undo action name");
  • trunk/Source/WebKit2/ChangeLog

    r183360 r183368  
     12015-04-26  Doug Russell  <d_russell@apple.com>
     2
     3        AX: richer text change notifications (142719)
     4        https://bugs.webkit.org/show_bug.cgi?id=142719
     5
     6        Reviewed by Darin Adler.
     7
     8        Richer accessibility value change notifications. Introduce AXTextEditType,
     9        postTextStateChangeNotification and postTextReplacementNotification to give assistive
     10        tech apps more reliable context for responding to changes in web content. Also implement
     11        a mechanism to post value changes in password form fields in coalesced ticks to thwart
     12        analyzing the cadence of changes.
     13
     14        Richer accessibility selection change notifications. Introduce AXTextStateChangeIntent,
     15        and an overload of postTextReplacementNotification to give assistive tech apps more
     16        reliable context for responding to changes in web content selection. Also block posting
     17        selection changes on password fields.
     18
     19        * UIProcess/WebEditCommandProxy.cpp:
     20        (WebKit::WebEditCommandProxy::nameForEditAction):
     21
    1222015-04-26  Dan Bernstein  <mitz@apple.com>
    223
  • trunk/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp

    r183283 r183368  
    7474    switch (editAction) {
    7575    case EditActionUnspecified:
     76        return String();
     77    case EditActionInsert:
    7678        return String();
    7779    case EditActionSetColor:
  • trunk/Tools/ChangeLog

    r183344 r183368  
     12015-04-26  Doug Russell  <d_russell@apple.com>
     2
     3        AX: richer text change notifications (142719)
     4        https://bugs.webkit.org/show_bug.cgi?id=142719
     5
     6        Reviewed by Darin Adler.
     7
     8        Richer accessibility value change notifications. Introduce AXTextEditType,
     9        postTextStateChangeNotification and postTextReplacementNotification to give assistive
     10        tech apps more reliable context for responding to changes in web content. Also implement
     11        a mechanism to post value changes in password form fields in coalesced ticks to thwart
     12        analyzing the cadence of changes.
     13
     14        Richer accessibility selection change notifications. Introduce AXTextStateChangeIntent,
     15        and an overload of postTextReplacementNotification to give assistive tech apps more
     16        reliable context for responding to changes in web content selection. Also block posting
     17        selection changes on password fields.
     18
     19        * DumpRenderTree/mac/AccessibilityNotificationHandler.h:
     20        * DumpRenderTree/mac/AccessibilityNotificationHandler.mm:
     21        (-[AccessibilityNotificationHandler stopObserving]):
     22        (-[AccessibilityNotificationHandler _notificationReceived:]):
     23        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     24        (AccessibilityUIElement::removeNotificationListener):
     25        * WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:
     26        (-[AccessibilityNotificationHandler _notificationReceived:]):
     27        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     28        (WTR::AccessibilityUIElement::removeNotificationListener):
     29
    1302015-04-25  Sungmann Cho  <sungmann.cho@navercorp.com>
    231
  • trunk/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.h

    r183283 r183368  
    4343- (void)setCallback:(JSObjectRef)callback;
    4444- (void)startObserving;
     45- (void)stopObserving;
    4546
    4647@end
  • trunk/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm

    r183283 r183368  
    105105}
    106106
     107- (void)stopObserving
     108{
     109    [[NSNotificationCenter defaultCenter] removeObserver:self];
     110}
     111
    107112- (void)_notificationReceived:(NSNotification *)notification
    108113{
     
    113118        return;
    114119
     120    NSString *userInfoJSONValue = notification.userInfo[@"userInfo"];
     121
    115122    JSRetainPtr<JSStringRef> jsNotification(Adopt, [notificationName createJSStringRef]);
    116123    JSValueRef notificationNameArgument = JSValueMakeString([mainFrame globalContext], jsNotification.get());
     124    JSValueRef userInfoJSONValueArgument = nil;
     125    if ([userInfoJSONValue length]) {
     126        JSRetainPtr<JSStringRef> jsUserInfoJSONValue(Adopt, [userInfoJSONValue createJSStringRef]);
     127        userInfoJSONValueArgument = JSValueMakeFromJSONString([mainFrame globalContext], jsUserInfoJSONValue.get());
     128    }
    117129    if (m_platformElement) {
    118         // Listener for one element just gets one argument, the notification name.
    119         JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 1, &notificationNameArgument, 0);
     130        // Listener for one element gets the notification name and userInfo.
     131        JSValueRef arguments[2];
     132        arguments[0] = notificationNameArgument;
     133        arguments[1] = userInfoJSONValueArgument;
     134        JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 2, arguments, 0);
    120135    } else {
    121         // A global listener gets the element and the notification name as arguments.
    122         JSValueRef arguments[2];
     136        // A global listener gets the element, notification name and userInfo.
     137        JSValueRef arguments[3];
    123138        arguments[0] = AccessibilityUIElement::makeJSAccessibilityUIElement([mainFrame globalContext], AccessibilityUIElement([notification object]));
    124139        arguments[1] = notificationNameArgument;
     140        arguments[2] = userInfoJSONValueArgument;
    125141        JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 2, arguments, 0);
    126142    }
  • trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r183283 r183368  
    14471447    ASSERT(m_notificationHandler);
    14481448
     1449    [m_notificationHandler stopObserving];
    14491450    [m_notificationHandler release];
    14501451    m_notificationHandler = nil;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm

    r183283 r183368  
    126126        return;
    127127
     128    NSString *userInfoJSONValue = notification.userInfo[@"userInfo"];
     129
    128130    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(WTR::InjectedBundle::singleton().page()->page());
    129131    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
     
    131133    JSRetainPtr<JSStringRef> jsNotification(Adopt, [notificationName createJSStringRef]);
    132134    JSValueRef notificationNameArgument = JSValueMakeString(context, jsNotification.get());
     135    JSValueRef userInfoJSONValueArgument = nil;
     136    if ([userInfoJSONValue length]) {
     137        JSRetainPtr<JSStringRef> jsUserInfoJSONValue(Adopt, [userInfoJSONValue createJSStringRef]);
     138        userInfoJSONValueArgument = JSValueMakeFromJSONString(context, jsUserInfoJSONValue.get());
     139    }
    133140    if (m_platformElement) {
    134         // Listener for one element just gets one argument, the notification name.
    135         JSObjectCallAsFunction(context, const_cast<JSObjectRef>(m_notificationFunctionCallback), 0, 1, &notificationNameArgument, 0);
     141        // Listener for one element gets the notification name and userInfo.
     142        JSValueRef arguments[2];
     143        arguments[0] = notificationNameArgument;
     144        arguments[1] = userInfoJSONValueArgument;
     145        JSObjectCallAsFunction(context, const_cast<JSObjectRef>(m_notificationFunctionCallback), 0, 2, arguments, 0);
    136146    } else {
    137         // A global listener gets the element and the notification name as arguments.
    138         JSValueRef arguments[2];
     147        // A global listener gets the element, notification name and userInfo.
     148        JSValueRef arguments[3];
    139149        arguments[0] = toJS(context, WTF::getPtr(WTR::AccessibilityUIElement::create([notification object])));
    140150        arguments[1] = notificationNameArgument;
     151        arguments[2] = userInfoJSONValueArgument;
    141152        JSObjectCallAsFunction(context, const_cast<JSObjectRef>(m_notificationFunctionCallback), 0, 2, arguments, 0);
    142153    }
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r183283 r183368  
    14771477    ASSERT(m_notificationHandler);
    14781478
     1479    [m_notificationHandler stopObserving];
    14791480    [m_notificationHandler release];
    14801481    m_notificationHandler = nil;
Note: See TracChangeset for help on using the changeset viewer.