Changeset 183368 in webkit
- Timestamp:
- Apr 26, 2015 3:17:11 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 74 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183366 r183368 1 2015-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 1 26 2015-04-26 Darin Adler <darin@apple.com> 2 27 -
trunk/LayoutTests/platform/mac/TestExpectations
r183217 r183368 1264 1264 webkit.org/b/142548 [ Yosemite+ ] editing/selection/extend-by-character-007.html [ Pass ] 1265 1265 webkit.org/b/141661 [ Yosemite+ ] fast/text/emoji.html [ Pass ] 1266 1267 # Timing out on Yosemite & Mavericks WK1 release sometimes 1268 webkit.org/b/142719 platform/mac/accessibility/select-text.html [ Pass Timeout ] -
trunk/Source/WebCore/CMakeLists.txt
r183283 r183368 1514 1514 editing/RemoveNodePreservingChildrenCommand.cpp 1515 1515 editing/RenderedPosition.cpp 1516 editing/ReplaceDeleteFromTextNodeCommand.cpp 1517 editing/ReplaceInsertIntoTextNodeCommand.cpp 1516 1518 editing/ReplaceNodeWithSpanCommand.cpp 1517 1519 editing/ReplaceSelectionCommand.cpp -
trunk/Source/WebCore/ChangeLog
r183367 r183368 1 2015-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 1 238 2015-04-26 Darin Adler <darin@apple.com> 2 239 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r183283 r183368 14765 14765 </ClCompile> 14766 14766 <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"> 14767 14795 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> 14768 14796 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> … … 19546 19574 <ClInclude Include="..\accessibility\AccessibilityTableRow.h" /> 19547 19575 <ClInclude Include="..\accessibility\AXObjectCache.h" /> 19576 <ClInclude Include="..\accessibility\AXTextStateChangeIntent.h" /> 19548 19577 <ClInclude Include="..\accessibility\win\AccessibilityObjectWrapperWin.h" /> 19549 19578 <ClInclude Include="..\page\AdjustViewSizeOrNot.h" /> … … 21088 21117 <ClInclude Include="..\editing\RemoveNodePreservingChildrenCommand.h" /> 21089 21118 <ClInclude Include="..\editing\RenderedPosition.h" /> 21119 <ClInclude Include="..\editing\ReplaceDeleteFromTextNodeCommand.h" /> 21120 <ClInclude Include="..\editing\ReplaceInsertIntoTextNodeCommand.h" /> 21090 21121 <ClInclude Include="..\editing\ReplaceNodeWithSpanCommand.h" /> 21091 21122 <ClInclude Include="..\editing\ReplaceSelectionCommand.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r183283 r183368 3526 3526 <Filter>editing</Filter> 3527 3527 </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> 3528 3534 <ClCompile Include="..\editing\ReplaceNodeWithSpanCommand.cpp"> 3529 3535 <Filter>editing</Filter> … … 7669 7675 <Filter>accessibility</Filter> 7670 7676 </ClInclude> 7677 <ClInclude Include="..\accessibility\AXTextStateChangeIntent.h"> 7678 <Filter>accessibility</Filter> 7679 </ClInclude> 7671 7680 <ClInclude Include="..\accessibility\win\AccessibilityObjectWrapperWin.h"> 7672 7681 <Filter>accessibility\win</Filter> … … 10676 10685 </ClInclude> 10677 10686 <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"> 10678 10693 <Filter>editing</Filter> 10679 10694 </ClInclude> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r183283 r183368 3251 3251 9001788012E0370700648462 /* JSOESStandardDerivatives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */; }; 3252 3252 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, ); }; }; 3253 3254 9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; }; 3254 3255 9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 6396 6397 F544F78815CFB2A800AF33A8 /* PlatformLocale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */; }; 6397 6398 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 */; }; 6398 6403 F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; }; 6399 6404 F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */; }; … … 10501 10506 9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESStandardDerivatives.cpp; sourceTree = "<group>"; }; 10502 10507 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>"; }; 10503 10509 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; }; 10504 10510 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroup.h; sourceTree = "<group>"; }; … … 14041 14047 F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformLocale.cpp; sourceTree = "<group>"; }; 14042 14048 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>"; }; 14043 14053 F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTextInputType.cpp; sourceTree = "<group>"; }; 14044 14054 F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTextInputType.h; sourceTree = "<group>"; }; … … 15662 15672 2981CAAF131822EC00D12F2A /* AXObjectCache.cpp */, 15663 15673 29A8121A0FBB9C1D00510293 /* AXObjectCache.h */, 15674 91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */, 15664 15675 ); 15665 15676 path = accessibility; … … 17795 17806 9B32CDA813DF7FA900F34D13 /* RenderedPosition.cpp */, 17796 17807 9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */, 17808 F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */, 17809 F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */, 17810 F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */, 17811 F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */, 17797 17812 A89CCC500F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.cpp */, 17798 17813 A89CCC510F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h */, … … 23729 23744 0F580FAF149800D400FB5BD8 /* AnimationUtilities.h in Headers */, 23730 23745 4A4F65721AA997F100E38CDD /* RealtimeMediaSourceCapabilities.h in Headers */, 23746 F5528DA51AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h in Headers */, 23731 23747 93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */, 23732 23748 1A8F6BBD0DB55CDC001DB794 /* ApplicationCache.h in Headers */, … … 25654 25670 F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */, 25655 25671 BCDFD4960E30592F009D10AD /* JSXMLHttpRequestUpload.h in Headers */, 25672 F5528DAA1AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h in Headers */, 25656 25673 1ACE53F70A8D19470022947D /* JSXMLSerializer.h in Headers */, 25657 25674 1A762C740A074F2600989F5B /* JSXPathEvaluator.h in Headers */, … … 26707 26724 83C1D428178D5AB400141E68 /* SVGPathSegCurvetoCubicRel.h in Headers */, 26708 26725 B2227A690D00BF220071B782 /* SVGPathSegCurvetoCubicSmooth.h in Headers */, 26726 91C9F2F91AE3BEB00095B61C /* AXTextStateChangeIntent.h in Headers */, 26709 26727 83C1D429178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothAbs.h in Headers */, 26710 26728 83C1D42A178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothRel.h in Headers */, … … 28465 28483 A77979190D6B9D0C003851B9 /* ImageData.cpp in Sources */, 28466 28484 97205AB51239291000B17380 /* ImageDocument.cpp in Sources */, 28485 F5528DA61AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp in Sources */, 28467 28486 F55B3DC11251F12D003EF269 /* ImageInputType.cpp in Sources */, 28468 28487 089582550E857A7E00F82C83 /* ImageLoader.cpp in Sources */, … … 29912 29931 1A2E6E590CC55213004A2062 /* SQLValue.cpp in Sources */, 29913 29932 4476531B133170990006B789 /* SSLKeyGeneratorIOS.cpp in Sources */, 29933 F5528DA91AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp in Sources */, 29914 29934 93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.cpp in Sources */, 29915 29935 BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */, -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r183283 r183368 1 1 /* 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2009, 2010, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 91 91 using namespace HTMLNames; 92 92 93 // Post value change notifications for password fields or elements contained in password fields at a 40hz interval to thwart analysis of typing cadence 94 static double AccessibilityPasswordValueChangeNotificationInterval = 0.025; 95 93 96 AccessibilityObjectInclusion AXComputedObjectAttributeCache::getIgnored(AXID id) const 94 97 { … … 130 133 : m_document(document) 131 134 , m_notificationPostTimer(*this, &AXObjectCache::notificationPostTimerFired) 135 , m_passwordNotificationPostTimer(*this, &AXObjectCache::passwordNotificationPostTimerFired) 132 136 { 133 137 } … … 706 710 m_notificationPostTimer.stop(); 707 711 708 // In DRT, posting notifications has a tendency to immediately queue up other notifications, which can lead to unexpected behavior712 // In tests, posting notifications has a tendency to immediately queue up other notifications, which can lead to unexpected behavior 709 713 // when the notification list is cleared at the end. Instead copy this list at the start. 710 714 auto notifications = WTF::move(m_notificationsToPost); … … 743 747 } 744 748 } 749 750 void 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 } 745 763 746 764 void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, PostTarget postTarget, PostType postType) … … 851 869 } 852 870 853 void AXObjectCache::nodeTextChangeNotification(Node* node, AXTextChange textChange, unsigned offset, const String& text) 871 #ifndef NDEBUG 872 void 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 985 void AXObjectCache::setTextSelectionIntent(AXTextStateChangeIntent intent) 986 { 987 m_textSelectionIntent = intent; 988 } 989 990 static bool isPasswordFieldOrContainedByPasswordField(AccessibilityObject* object) 991 { 992 return object && (object->isPasswordField() || object->isContainedByPasswordField()); 993 } 994 995 void AXObjectCache::postTextStateChangeNotification(Node* node, const AXTextStateChangeIntent& intent, const VisibleSelection& selection) 854 996 { 855 997 if (!node) 856 998 return; 857 999 1000 #if PLATFORM(COCOA) 858 1001 stopCachingComputedObjectAttributes(); 859 1002 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 1020 void 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 1042 void 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 1066 bool 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; 863 1083 } 864 1084 … … 1085 1305 } 1086 1306 1307 AccessibilityObject* AXObjectCache::rootWebArea() 1308 { 1309 AccessibilityObject* rootObject = this->rootObject(); 1310 if (!rootObject || !rootObject->isAccessibilityScrollView()) 1311 return nullptr; 1312 return downcast<AccessibilityScrollView>(*rootObject).webAreaObject(); 1313 } 1314 1087 1315 AXAttributeCacheEnabler::AXAttributeCacheEnabler(AXObjectCache* cache) 1088 1316 : m_cache(cache) … … 1097 1325 m_cache->stopCachingComputedObjectAttributes(); 1098 1326 } 1327 1328 #if !PLATFORM(COCOA) 1329 AXTextChange 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 1099 1347 1100 1348 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r183283 r183368 1 1 /* 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. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #define AXObjectCache_h 28 28 29 #include "AXTextStateChangeIntent.h" 29 30 #include "AccessibilityObject.h" 30 31 #include "Timer.h" … … 33 34 #include <wtf/HashMap.h> 34 35 #include <wtf/HashSet.h> 36 #include <wtf/ListHashSet.h> 35 37 #include <wtf/RefPtr.h> 36 38 … … 67 69 HashMap<AXID, CachedAXObjectAttributes> m_idMapping; 68 70 }; 71 72 #if !PLATFORM(COCOA) 73 enum AXTextChange { AXTextInserted, AXTextDeleted }; 74 #endif 69 75 70 76 enum PostTarget { TargetElement, TargetObservableParent }; … … 190 196 void postNotification(AccessibilityObject*, Document*, AXNotification, PostTarget = TargetElement, PostType = PostAsynchronously); 191 197 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&); 198 207 199 208 enum AXLoadingEvent { … … 214 223 215 224 Document& document() const { return m_document; } 216 225 226 #if PLATFORM(MAC) 227 static void setShouldRepostNotificationsForTests(bool value); 228 #endif 229 217 230 protected: 218 231 void postPlatformNotification(AccessibilityObject*, AXNotification); 219 232 void platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode); 220 233 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 222 243 void frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent); 223 244 void textChanged(AccessibilityObject*); … … 230 251 231 252 private: 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 232 268 Document& m_document; 233 269 HashMap<AXID, RefPtr<AccessibilityObject>> m_objects; … … 239 275 WEBCORE_EXPORT static bool gAccessibilityEnabled; 240 276 WEBCORE_EXPORT static bool gAccessibilityEnhancedUserInterfaceEnabled; 241 277 242 278 HashSet<AXID> m_idsInUse; 243 279 244 280 Timer m_notificationPostTimer; 245 281 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; 254 288 }; 255 289 … … 309 343 inline void AXObjectCache::recomputeIsIgnored(RenderObject*) { } 310 344 inline 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&) { } 345 inline void AXObjectCache::postTextStateChangeNotification(Node*, const AXTextStateChangeIntent&, const VisibleSelection&) { } 346 inline void AXObjectCache::postTextStateChangeNotification(Node*, AXTextEditType, const String&, const VisiblePosition&) { } 347 inline void AXObjectCache::postTextReplacementNotification(Node*, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&) { } 313 348 inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, PostTarget, PostType) { } 314 349 inline void AXObjectCache::postNotification(RenderObject*, AXNotification, PostTarget, PostType) { } … … 321 356 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { } 322 357 inline void AXObjectCache::selectedChildrenChanged(Node*) { } 358 #if PLATFORM(COCOA) 359 inline void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject*, const AXTextStateChangeIntent&, const VisibleSelection&) { } 360 inline void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject*, AXTextEditType, const String&, const VisiblePosition&) { } 361 inline void AXObjectCache::postTextReplacementPlatformNotification(AccessibilityObject*, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&) { } 362 #else 363 inline AXTextChange AXObjectCache::textChangeForEditType(AXTextEditType) { return AXTextInserted; } 364 inline void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&) { } 365 #endif 323 366 #endif 324 367 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r183283 r183368 553 553 } 554 554 555 AccessibilityObject* 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 555 576 bool AccessibilityNodeObject::isInputImage() const 556 577 { -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h
r183283 r183368 89 89 virtual bool isNativeTextControl() const override; 90 90 virtual bool isPasswordField() const override; 91 virtual AccessibilityObject* passwordFieldOrContainingPasswordField() override; 91 92 virtual bool isProgressIndicator() const override; 92 93 virtual bool isSearchField() const override; -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r183283 r183368 2647 2647 #endif 2648 2648 2649 bool 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 2649 2662 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r183283 r183368 464 464 virtual bool isImageButton() const { return false; } 465 465 virtual bool isPasswordField() const { return false; } 466 bool isContainedByPasswordField() const; 467 virtual AccessibilityObject* passwordFieldOrContainingPasswordField() { return nullptr; } 466 468 virtual bool isNativeTextControl() const { return false; } 467 469 virtual bool isSearchField() const { return false; } -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r183283 r183368 1492 1492 { 1493 1493 if (isNativeTextControl()) { 1494 if (AXObjectCache* cache = axObjectCache()) 1495 cache->setTextSelectionIntent(AXTextStateChangeIntent(range.length ? AXTextStateChangeTypeSelectionExtend : AXTextStateChangeTypeSelectionMove, true)); 1494 1496 HTMLTextFormControlElement& textControl = downcast<RenderTextControl>(*m_renderer).textFormControlElement(); 1495 1497 textControl.setSelectionRange(range.start, range.start + range.length); … … 1498 1500 1499 1501 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); 1502 1505 } 1503 1506 … … 1964 1967 if (range.start.isNull() || range.end.isNull()) 1965 1968 return; 1966 1969 1967 1970 // 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)); 1969 1974 m_renderer->frame().selection().moveTo(range.start, UserTriggered); 1975 } 1970 1976 else { 1971 1977 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)); 1973 1979 } 1974 1980 } -
trunk/Source/WebCore/accessibility/AccessibilityScrollView.h
r183283 r183368 44 44 virtual void detach(AccessibilityDetachmentType, AXObjectCache*) override; 45 45 46 AccessibilityObject* webAreaObject() const; 47 46 48 private: 47 49 explicit AccessibilityScrollView(ScrollView*); … … 72 74 virtual AccessibilityObject* parentObjectIfExists() const override; 73 75 74 AccessibilityObject* webAreaObject() const;75 76 virtual AccessibilityObject* firstChild() const override { return webAreaObject(); } 76 77 AccessibilityScrollbar* addChildScrollbar(Scrollbar*); -
trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
r183283 r183368 269 269 CString detail; 270 270 switch (textChange) { 271 case AX ObjectCache::AXTextInserted:271 case AXTextInserted: 272 272 detail = "text-insert"; 273 273 break; 274 case AX ObjectCache::AXTextDeleted:274 case AXTextDeleted: 275 275 detail = "text-remove"; 276 276 break; -
trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm
r183283 r183368 96 96 } 97 97 98 void AXObjectCache:: nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, const String&)98 void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, const AXTextStateChangeIntent&, const VisibleSelection&) 99 99 { 100 postPlatformNotification(object, AXSelectedTextChanged); 101 } 102 103 void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, AXTextEditType, const String&, const VisiblePosition&) 104 { 105 postPlatformNotification(object, AXValueChanged); 106 } 107 108 void AXObjectCache::postTextReplacementPlatformNotification(AccessibilityObject* object, AXTextEditType, const String&, AXTextEditType, const String&, const VisiblePosition&) 109 { 110 postPlatformNotification(object, AXValueChanged); 100 111 } 101 112 -
trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
r183283 r183368 45 45 #endif 46 46 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. 92 static const NSUInteger AXValueChangeTruncationLength = 1000; 93 47 94 // The simple Cocoa calls in this file don't throw exceptions. 48 95 … … 59 106 RetainPtr<WebAccessibilityObjectWrapper> wrapper = adoptNS([[WebAccessibilityObjectWrapper alloc] initWithAccessibilityObject:obj]); 60 107 obj->setWrapper(wrapper.get()); 108 } 109 110 static BOOL axShouldRepostNotificationsForTests = false; 111 112 void AXObjectCache::setShouldRepostNotificationsForTests(bool value) 113 { 114 axShouldRepostNotificationsForTests = value; 115 } 116 117 static 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]; 61 123 } 62 124 … … 150 212 ASSERT([obj->wrapper() accessibilityIsIgnored] || true); 151 213 #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 218 void 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 267 static 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 287 void 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 295 void 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]; 161 322 } 162 323 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h
r183283 r183368 57 57 58 58 - (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. 60 60 - (void)accessibilityPostedNotification:(NSString *)notificationName; 61 - (void)accessibilityPostedNotification:(NSString *)notificationName userInfo:(NSDictionary *)userInfo; 61 62 62 63 - (CGPathRef)convertPathToScreenSpace:(WebCore::Path &)path; -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
r183283 r183368 384 384 { 385 385 accessibilityShouldRepostNotifications = repost; 386 #if PLATFORM(MAC) 387 AXObjectCache::setShouldRepostNotificationsForTests(repost); 388 #endif 386 389 } 387 390 388 391 - (void)accessibilityPostedNotification:(NSString *)notificationName 389 392 { 393 if (accessibilityShouldRepostNotifications) 394 [self accessibilityPostedNotification:notificationName userInfo:nil]; 395 } 396 397 static 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 416 static 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 { 390 434 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]; 393 449 } 394 450 } -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.h
r183283 r183368 34 34 @interface WebAccessibilityObjectWrapper : WebAccessibilityObjectWrapperBase 35 35 36 - (id)textMarkerRangeFromVisiblePositions:(const WebCore::VisiblePosition&)startPosition endPosition:(const WebCore::VisiblePosition&)endPosition; 37 - (id)textMarkerForVisiblePosition:(const WebCore::VisiblePosition&)visiblePos; 38 36 39 @end 37 40 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r183283 r183368 1137 1137 } 1138 1138 1139 static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, VisiblePosition startPosition, VisiblePositionendPosition)1139 static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const VisiblePosition& startPosition, const VisiblePosition& endPosition) 1140 1140 { 1141 1141 id startTextMarker = textMarkerForVisiblePosition(cache, startPosition); … … 1144 1144 } 1145 1145 1146 - (id)textMarkerRangeFromVisiblePositions:( VisiblePosition)startPosition endPosition:(VisiblePosition)endPosition1146 - (id)textMarkerRangeFromVisiblePositions:(const VisiblePosition&)startPosition endPosition:(const VisiblePosition&)endPosition 1147 1147 { 1148 1148 return textMarkerRangeFromVisiblePositions(m_object->axObjectCache(), startPosition, endPosition); -
trunk/Source/WebCore/editing/AppendNodeCommand.cpp
r183283 r183368 31 31 #include "ExceptionCodePlaceholder.h" 32 32 #include "RenderElement.h" 33 #include "Text.h" 33 34 #include "htmlediting.h" 34 35 35 36 namespace WebCore { 36 37 37 AppendNodeCommand::AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node )38 : SimpleEditCommand(parent->document() )38 AppendNodeCommand::AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node, EditAction editingAction) 39 : SimpleEditCommand(parent->document(), editingAction) 39 40 , m_parent(parent) 40 41 , m_node(node) … … 47 48 } 48 49 49 static void sendAXTextChangedIgnoringLineBreaks(Node* node, AX ObjectCache::AXTextChange textChange)50 static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXTextEditType type) 50 51 { 51 String nodeValue = node->nodeValue(); 52 if (!node) 53 return; 54 55 if (!AXObjectCache::accessibilityEnabled()) 56 return; 57 58 String text = node->nodeValue(); 52 59 // Don't consider linebreaks in this command 53 if ( nodeValue== "\n")60 if (text == "\n") 54 61 return; 55 62 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 } 58 67 } 59 68 … … 65 74 m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION); 66 75 67 if (AXObjectCache::accessibilityEnabled()) 68 sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextInserted); 76 sendAXTextChangedIgnoringLineBreaks(m_node.get(), applyEditType()); 69 77 } 70 78 … … 73 81 if (!m_parent->hasEditableStyle()) 74 82 return; 75 83 76 84 // 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()); 79 86 80 87 m_node->remove(IGNORE_EXCEPTION); -
trunk/Source/WebCore/editing/AppendNodeCommand.h
r183283 r183368 33 33 class AppendNodeCommand : public SimpleEditCommand { 34 34 public: 35 static Ref<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node )35 static Ref<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node, EditAction editingAction) 36 36 { 37 return adoptRef(*new AppendNodeCommand(parent, node ));37 return adoptRef(*new AppendNodeCommand(parent, node, editingAction)); 38 38 } 39 39 40 40 private: 41 AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> );41 AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>, EditAction); 42 42 43 43 virtual void doApply() override; -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r183283 r183368 124 124 125 125 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* style, EditAction editingAction, EPropertyLevel propertyLevel) 126 : CompositeEditCommand(document )126 : CompositeEditCommand(document, editingAction) 127 127 , m_style(style->copy()) 128 , m_editingAction(editingAction)129 128 , m_propertyLevel(propertyLevel) 130 129 , m_start(endingSelection().start().downstream()) … … 137 136 138 137 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* style, const Position& start, const Position& end, EditAction editingAction, EPropertyLevel propertyLevel) 139 : CompositeEditCommand(document )138 : CompositeEditCommand(document, editingAction) 140 139 , m_style(style->copy()) 141 , m_editingAction(editingAction)142 140 , m_propertyLevel(propertyLevel) 143 141 , m_start(start) … … 150 148 151 149 ApplyStyleCommand::ApplyStyleCommand(PassRefPtr<Element> element, bool removeOnly, EditAction editingAction) 152 : CompositeEditCommand(element->document() )150 : CompositeEditCommand(element->document(), editingAction) 153 151 , m_style(EditingStyle::create()) 154 , m_editingAction(editingAction)155 152 , m_propertyLevel(PropertyDefault) 156 153 , m_start(endingSelection().start().downstream()) … … 164 161 165 162 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction editingAction) 166 : CompositeEditCommand(document )163 : CompositeEditCommand(document, editingAction) 167 164 , m_style(style->copy()) 168 , m_editingAction(editingAction)169 165 , m_propertyLevel(PropertyDefault) 170 166 , m_start(endingSelection().start().downstream()) … … 225 221 break; 226 222 } 227 }228 229 EditAction ApplyStyleCommand::editingAction() const230 {231 return m_editingAction;232 223 } 233 224 -
trunk/Source/WebCore/editing/ApplyStyleCommand.h
r183283 r183368 73 73 74 74 virtual void doApply() override; 75 virtual EditAction editingAction() const override;76 75 77 76 // style-removal helpers … … 123 122 124 123 RefPtr<EditingStyle> m_style; 125 EditAction m_editingAction;126 124 EPropertyLevel m_propertyLevel; 127 125 Position m_start; -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r183283 r183368 59 59 #include "RenderText.h" 60 60 #include "RenderedDocumentMarker.h" 61 #include "ReplaceDeleteFromTextNodeCommand.h" 62 #include "ReplaceInsertIntoTextNodeCommand.h" 61 63 #include "ReplaceNodeWithSpanCommand.h" 62 64 #include "ReplaceSelectionCommand.h" … … 163 165 #endif 164 166 167 AXTextEditType 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 165 185 void applyCommand(PassRefPtr<CompositeEditCommand> command) 166 186 { … … 168 188 } 169 189 170 CompositeEditCommand::CompositeEditCommand(Document& document )171 : EditCommand(document )190 CompositeEditCommand::CompositeEditCommand(Document& document, EditAction editingAction) 191 : EditCommand(document, editingAction) 172 192 { 173 193 } … … 188 208 case EditActionCut: 189 209 case EditActionUnspecified: 210 case EditActionInsert: 190 211 case EditActionDelete: 191 212 case EditActionDictation: … … 297 318 void CompositeEditCommand::insertParagraphSeparator(bool useDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea) 298 319 { 299 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea ));320 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea, editingAction())); 300 321 } 301 322 … … 323 344 void CompositeEditCommand::insertNodeBefore(PassRefPtr<Node> insertChild, PassRefPtr<Node> refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) 324 345 { 325 applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChild, shouldAssumeContentIsAlwaysEditable ));346 applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChild, shouldAssumeContentIsAlwaysEditable, editingAction())); 326 347 } 327 348 … … 374 395 { 375 396 ASSERT(canHaveChildrenForEditing(parent.get())); 376 applyCommandToComposite(AppendNodeCommand::create(parent, node ));397 applyCommandToComposite(AppendNodeCommand::create(parent, node, editingAction())); 377 398 } 378 399 … … 398 419 void CompositeEditCommand::removeNodePreservingChildren(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) 399 420 { 400 applyCommandToComposite(RemoveNodePreservingChildrenCommand::create(node, shouldAssumeContentIsAlwaysEditable ));421 applyCommandToComposite(RemoveNodePreservingChildrenCommand::create(node, shouldAssumeContentIsAlwaysEditable, editingAction())); 401 422 } 402 423 … … 526 547 { 527 548 if (!text.isEmpty()) 528 applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, text ));549 applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, text, editingAction())); 529 550 } 530 551 531 552 void CompositeEditCommand::deleteTextFromNode(PassRefPtr<Text> node, unsigned offset, unsigned count) 532 553 { 533 applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count ));554 applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count, editingAction())); 534 555 } 535 556 … … 537 558 { 538 559 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); 540 562 if (!replacementText.isEmpty()) 541 applyCommandToComposite( InsertIntoTextNodeCommand::create(node, offset, replacementText));563 applyCommandToComposite(ReplaceInsertIntoTextNodeCommand::create(WTF::move(node), offset, replacementText, deleteCommand->deletedText(), editingAction())); 542 564 } 543 565 … … 1290 1312 if (!preserveStyle) 1291 1313 options |= ReplaceSelectionCommand::MatchStyle; 1292 applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, options));1314 applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTF::move(fragment), options)); 1293 1315 1294 1316 frame().editor().markMisspellingsAndBadGrammar(endingSelection()); -
trunk/Source/WebCore/editing/CompositeEditCommand.h
r183283 r183368 60 60 #endif 61 61 62 AXTextEditType unapplyEditType() const; 63 62 64 private: 63 65 EditCommandComposition(Document&, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, EditAction); … … 90 92 91 93 protected: 92 explicit CompositeEditCommand(Document& );94 explicit CompositeEditCommand(Document&, EditAction = EditActionUnspecified); 93 95 94 96 // -
trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
r183283 r183368 1 1 /* 2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2008, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 namespace WebCore { 36 36 37 DeleteFromTextNodeCommand::DeleteFromTextNodeCommand( PassRefPtr<Text> node, unsigned offset, unsigned count)38 : SimpleEditCommand(node->document() )37 DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(RefPtr<Text>&& node, unsigned offset, unsigned count, EditAction editingAction) 38 : SimpleEditCommand(node->document(), editingAction) 39 39 , m_node(node) 40 40 , m_offset(offset) … … 59 59 60 60 // 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))); 63 63 64 64 m_node->deleteData(m_offset, m_count, ec); … … 74 74 m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION); 75 75 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))); 78 78 } 79 79 -
trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h
r183283 r183368 1 1 /* 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2008, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 class DeleteFromTextNodeCommand : public SimpleEditCommand { 36 36 public: 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) 38 38 { 39 return adoptRef(*new DeleteFromTextNodeCommand( node, offset, count));39 return adoptRef(*new DeleteFromTextNodeCommand(WTF::move(node), offset, count, editingAction)); 40 40 } 41 41 42 const String& deletedText(); 43 44 protected: 45 DeleteFromTextNodeCommand(RefPtr<Text>&&, unsigned offset, unsigned count, EditAction); 46 42 47 private: 43 DeleteFromTextNodeCommand(PassRefPtr<Text>, unsigned offset, unsigned count);44 45 48 virtual void doApply() override; 46 49 virtual void doUnapply() override; … … 56 59 }; 57 60 61 inline const String& DeleteFromTextNodeCommand::deletedText() 62 { 63 return m_text; 64 } 65 58 66 } // namespace WebCore 59 67 -
trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp
r183283 r183368 73 73 } 74 74 75 DeleteSelectionCommand::DeleteSelectionCommand(Document& document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup )76 : CompositeEditCommand(document )75 DeleteSelectionCommand::DeleteSelectionCommand(Document& document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup, EditAction editingAction) 76 : CompositeEditCommand(document, editingAction) 77 77 , m_hasSelectionToDelete(false) 78 78 , m_smartDelete(smartDelete) … … 91 91 } 92 92 93 DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup )94 : CompositeEditCommand(selection.start().anchorNode()->document() )93 DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup, EditAction editingAction) 94 : CompositeEditCommand(selection.start().anchorNode()->document(), editingAction) 95 95 , m_hasSelectionToDelete(true) 96 96 , m_smartDelete(smartDelete) … … 885 885 } 886 886 887 EditAction DeleteSelectionCommand::editingAction() const888 {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(), so891 // the Undo menu correctly shows "Undo Typing"892 return EditActionCut;893 }894 895 887 // Normally deletion doesn't preserve the typing style that was present before it. For example, 896 888 // 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 35 35 class DeleteSelectionCommand : public CompositeEditCommand { 36 36 public: 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) 38 38 { 39 return adoptRef(*new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup ));39 return adoptRef(*new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup, editingAction)); 40 40 } 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) 42 42 { 43 return adoptRef(*new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup ));43 return adoptRef(*new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup, editingAction)); 44 44 } 45 45 46 46 protected: 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); 48 48 49 49 private: 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); 51 51 52 52 virtual void doApply(); 53 virtual EditAction editingAction() const;54 53 55 54 virtual bool preservesTypingStyle() const; -
trunk/Source/WebCore/editing/DictationCommand.cpp
r183283 r183368 116 116 Vector<DictationAlternative> alternativesInLine; 117 117 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); 119 119 applyCommandToComposite(command, endingSelection()); 120 120 } … … 125 125 return; 126 126 127 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document() ));127 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), false, false, EditActionDictation)); 128 128 } 129 129 -
trunk/Source/WebCore/editing/EditAction.h
r183283 r183368 30 30 typedef enum { 31 31 EditActionUnspecified, 32 EditActionInsert, 32 33 EditActionSetColor, 33 34 EditActionSetBackgroundColor, -
trunk/Source/WebCore/editing/EditCommand.cpp
r183283 r183368 27 27 #include "EditCommand.h" 28 28 29 #include "AXObjectCache.h" 29 30 #include "CompositeEditCommand.h" 30 31 #include "Document.h" … … 38 39 namespace WebCore { 39 40 40 EditCommand::EditCommand(Document& document )41 EditCommand::EditCommand(Document& document, EditAction editingAction) 41 42 : m_document(document) 42 43 , m_parent(0) 44 , m_editingAction(editingAction) 43 45 { 44 46 ASSERT(document.frame()); … … 68 70 EditAction EditCommand::editingAction() const 69 71 { 70 return EditActionUnspecified;72 return m_editingAction; 71 73 } 72 74 … … 113 115 } 114 116 117 AXTextEditType 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 139 AXTextEditType 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 156 SimpleEditCommand::SimpleEditCommand(Document& document, EditAction editingAction) 157 : EditCommand(document, editingAction) 158 { 159 } 160 115 161 void SimpleEditCommand::doReapply() 116 162 { … … 126 172 #endif 127 173 174 void 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 128 184 } // namespace WebCore -
trunk/Source/WebCore/editing/EditCommand.h
r183283 r183368 27 27 #define EditCommand_h 28 28 29 #include "AXTextStateChangeIntent.h" 29 30 #include "EditAction.h" 30 31 #include "VisibleSelection.h" … … 47 48 void setParent(CompositeEditCommand*); 48 49 49 virtualEditAction editingAction() const;50 EditAction editingAction() const; 50 51 51 52 const VisibleSelection& startingSelection() const { return m_startingSelection; } … … 60 61 virtual void doApply() = 0; 61 62 63 AXTextEditType applyEditType() const; 64 AXTextEditType unapplyEditType() const; 65 62 66 protected: 63 explicit EditCommand(Document& );67 explicit EditCommand(Document&, EditAction = EditActionUnspecified); 64 68 EditCommand(Document&, const VisibleSelection&, const VisibleSelection&); 65 69 … … 75 79 VisibleSelection m_endingSelection; 76 80 CompositeEditCommand* m_parent; 81 EditAction m_editingAction { EditActionUnspecified }; 77 82 }; 78 83 … … 92 97 93 98 protected: 94 explicit SimpleEditCommand(Document& document) : EditCommand(document) { }99 explicit SimpleEditCommand(Document&, EditAction = EditActionUnspecified); 95 100 96 101 #ifndef NDEBUG 97 102 void addNodeAndDescendants(Node*, HashSet<Node*>&); 98 103 #endif 104 105 virtual void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&); 99 106 100 107 private: -
trunk/Source/WebCore/editing/EditingAllInOne.cpp
r183283 r183368 60 60 #include <RemoveNodePreservingChildrenCommand.cpp> 61 61 #include <RenderedPosition.cpp> 62 #include <ReplaceDeleteFromTextNodeCommand.cpp> 63 #include <ReplaceInsertIntoTextNodeCommand.cpp> 62 64 #include <ReplaceNodeWithSpanCommand.cpp> 63 65 #include <ReplaceSelectionCommand.cpp> -
trunk/Source/WebCore/editing/Editor.cpp
r183283 r183368 209 209 return true; 210 210 #endif 211 replaceSelectionWithFragment(event->pastingFragment(), false, event->shouldSmartReplace(), event->shouldMatchStyle(), event->mailBlockquoteHandling());211 replaceSelectionWithFragment(event->pastingFragment(), false, event->shouldSmartReplace(), event->shouldMatchStyle(), EditActionPaste, event->mailBlockquoteHandling()); 212 212 #if PLATFORM(IOS) 213 213 } 214 214 #endif 215 215 else 216 replaceSelectionWithText(event->data(), false, event->shouldSmartReplace() );216 replaceSelectionWithText(event->data(), false, event->shouldSmartReplace(), EditActionPaste); 217 217 return true; 218 218 } … … 375 375 } 376 376 377 void Editor::deleteSelectionWithSmartDelete(bool smartDelete )377 void Editor::deleteSelectionWithSmartDelete(bool smartDelete, EditAction editingAction) 378 378 { 379 379 if (m_frame.selection().isNone()) 380 380 return; 381 381 382 applyCommand(DeleteSelectionCommand::create(document(), smartDelete ));382 applyCommand(DeleteSelectionCommand::create(document(), smartDelete, true, false, false, true, editingAction)); 383 383 } 384 384 … … 521 521 } 522 522 523 void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle, MailBlockquoteHandling mailBlockquoteHandling)523 void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle, EditAction editingAction, MailBlockquoteHandling mailBlockquoteHandling) 524 524 { 525 525 VisibleSelection selection = m_frame.selection().selection(); … … 537 537 options |= ReplaceSelectionCommand::IgnoreMailBlockquote; 538 538 539 applyCommand(ReplaceSelectionCommand::create(document(), fragment, options, EditActionPaste));539 applyCommand(ReplaceSelectionCommand::create(document(), fragment, options, editingAction)); 540 540 revealSelectionAfterEditingOperation(); 541 541 … … 551 551 } 552 552 553 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace )553 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace, EditAction editingAction) 554 554 { 555 555 RefPtr<Range> range = selectedRange(); … … 557 557 return; 558 558 559 replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, true );559 replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, true, editingAction); 560 560 } 561 561 … … 999 999 // Don't clear the typing style with this selection change. We do those things elsewhere if necessary. 1000 1000 FrameSelection::SetSelectionOptions options = cmd->isDictationCommand() ? FrameSelection::DictationTriggered : 0; 1001 changeSelectionAfterCommand(newSelection, options); 1001 1002 changeSelectionAfterCommand(newSelection, options, cmd->applyEditType()); 1002 1003 dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement()); 1003 1004 … … 1030 1031 1031 1032 VisibleSelection newSelection(cmd->startingSelection()); 1032 changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions() );1033 changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions(), cmd->unapplyEditType()); 1033 1034 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement()); 1034 1035 … … 1264 1265 didWriteSelectionToPasteboard(); 1265 1266 if (action == CutAction) 1266 deleteSelectionWithSmartDelete(canSmartCopyOrDelete() );1267 deleteSelectionWithSmartDelete(canSmartCopyOrDelete(), EditActionCut); 1267 1268 } 1268 1269 … … 2236 2237 if (!m_frame.editor().shouldInsertText(autocorrectedString, misspellingRange.get(), EditorInsertActionTyped)) 2237 2238 return; 2238 m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false );2239 m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false, EditActionInsert); 2239 2240 2240 2241 // Reset the charet one character further. … … 2582 2583 m_alternativeTextController->recordAutocorrectionResponseReversed(replacedString, selection); 2583 2584 TextCheckingParagraph paragraph(selection); 2584 replaceSelectionWithText(replacedString, false, false );2585 replaceSelectionWithText(replacedString, false, false, EditActionInsert); 2585 2586 RefPtr<Range> changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length()); 2586 2587 changedRange->startContainer()->document().markers().addMarker(changedRange.get(), DocumentMarker::Replacement, String()); … … 2816 2817 if (!shouldInsertText(transposed, range.get(), EditorInsertActionTyped)) 2817 2818 return; 2818 replaceSelectionWithText(transposed, false, false );2819 replaceSelectionWithText(transposed, false, false, EditActionInsert); 2819 2820 } 2820 2821 … … 2848 2849 } 2849 2850 2850 void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions options)2851 void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions options, AXTextStateChangeIntent intent) 2851 2852 { 2852 2853 // If the new selection is orphaned, then don't update the selection. … … 2860 2861 bool selectionDidNotChangeDOMPosition = newSelection == m_frame.selection().selection(); 2861 2862 if (selectionDidNotChangeDOMPosition || m_frame.selection().shouldChangeSelection(newSelection)) 2862 m_frame.selection().setSelection(newSelection, options );2863 m_frame.selection().setSelection(newSelection, options, intent); 2863 2864 2864 2865 // Some editing operations change the selection visually without affecting its position within the DOM. -
trunk/Source/WebCore/editing/Editor.h
r183283 r183368 175 175 176 176 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); 178 178 void clearText(); 179 179 #if PLATFORM(IOS) … … 383 383 WEBCORE_EXPORT WritingDirection baseWritingDirectionForSelectionStart() const; 384 384 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); 387 387 WEBCORE_EXPORT bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const; 388 388 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection); … … 469 469 void setComposition(const String&, SetCompositionMode); 470 470 471 void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions );471 void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions, AXTextStateChangeIntent = AXTextStateChangeIntent()); 472 472 473 473 enum EditorActionSpecifier { CutAction, CopyAction }; -
trunk/Source/WebCore/editing/EditorCommand.cpp
r183283 r183368 193 193 { 194 194 ASSERT(frame.document()); 195 applyCommand(ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectionCommand::PreventNesting, EditAction Unspecified));195 applyCommand(ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectionCommand::PreventNesting, EditActionInsert)); 196 196 return true; 197 197 } -
trunk/Source/WebCore/editing/FrameSelection.cpp
r183283 r183368 27 27 #include "FrameSelection.h" 28 28 29 #include "AXObjectCache.h" 29 30 #include "CharacterData.h" 30 31 #include "DeleteSelectionCommand.h" … … 140 141 { 141 142 setSelection(VisibleSelection(pos.deepEquivalent(), pos.deepEquivalent(), pos.affinity(), m_selection.isDirectional()), 142 defaultSetSelectionOptions(userTriggered), align);143 defaultSetSelectionOptions(userTriggered), AXTextStateChangeIntent(), align); 143 144 } 144 145 … … 171 172 newSelection.setWithoutValidation(base, extent); 172 173 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); 174 176 } 175 177 … … 255 257 return; 256 258 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); 258 266 } 259 267 … … 277 285 if (RefPtr<Frame> newSelectionFrame = newSelectionDocument->frame()) { 278 286 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); 280 288 // It's possible that during the above set selection, this FrameSelection has been modified by 281 289 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since … … 321 329 } 322 330 323 void FrameSelection::setSelection(const VisibleSelection& selection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)331 void FrameSelection::setSelection(const VisibleSelection& selection, SetSelectionOptions options, AXTextStateChangeIntent intent, CursorAlignOnScroll align, TextGranularity granularity) 324 332 { 325 333 if (!setSelectionWithoutUpdatingAppearance(selection, options, align, granularity)) … … 342 350 return; 343 351 344 updateAndRevealSelection( );352 updateAndRevealSelection(intent); 345 353 } 346 354 … … 361 369 } 362 370 363 void FrameSelection::updateAndRevealSelection( )371 void FrameSelection::updateAndRevealSelection(const AXTextStateChangeIntent& intent) 364 372 { 365 373 if (!m_pendingSelectionUpdate) … … 381 389 } 382 390 383 notifyAccessibilityForSelectionChange( );391 notifyAccessibilityForSelectionChange(intent); 384 392 385 393 if (auto* client = m_frame->editor().client()) … … 1022 1030 { 1023 1031 return granularity == LineBoundary || granularity == ParagraphBoundary || granularity == DocumentBoundary; 1024 } 1032 } 1033 1034 AXTextStateChangeIntent 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 } 1025 1101 1026 1102 bool FrameSelection::modify(EAlteration alter, SelectionDirection direction, TextGranularity granularity, EUserTriggered userTriggered) … … 1077 1153 if (!wasRange && alter == AlterationMove && position == originalStartPosition) 1078 1154 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 } 1079 1160 1080 1161 // Some of the above operations set an xPosForVerticalArrowNavigation. … … 1711 1792 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(root.get())); 1712 1793 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 } 1715 1798 } 1716 1799 … … 2146 2229 { 2147 2230 setCaretRectNeedsUpdate(); 2148 updateAndRevealSelection( );2231 updateAndRevealSelection(AXTextStateChangeIntent()); 2149 2232 updateDataDetectorsForSelection(); 2150 2233 } … … 2424 2507 VisibleSelection newSelection = frameSelection.selection(); 2425 2508 newSelection.expandUsingGranularity(WordGranularity); 2426 frameSelection.setSelection(newSelection, defaultSetSelectionOptions(), A lignCursorOnScrollIfNeeded, frameSelection.granularity());2509 frameSelection.setSelection(newSelection, defaultSetSelectionOptions(), AXTextStateChangeIntent(), AlignCursorOnScrollIfNeeded, frameSelection.granularity()); 2427 2510 2428 2511 Position startPos(frameSelection.selection().start()); -
trunk/Source/WebCore/editing/FrameSelection.h
r183283 r183368 27 27 #define FrameSelection_h 28 28 29 #include "AXTextStateChangeIntent.h" 29 30 #include "EditingStyle.h" 30 31 #include "IntRect.h" … … 145 146 146 147 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); 148 149 WEBCORE_EXPORT bool setSelectedRange(Range*, EAffinity, bool closeTyping); 149 150 WEBCORE_EXPORT void selectAll(); … … 273 274 enum EPositionType { START, END, BASE, EXTENT }; 274 275 275 void updateAndRevealSelection( );276 void updateAndRevealSelection(const AXTextStateChangeIntent&); 276 277 void updateDataDetectorsForSelection(); 277 278 … … 298 299 LayoutUnit lineDirectionPointForBlockDirectionNavigation(EPositionType); 299 300 301 AXTextStateChangeIntent textSelectionIntent(EAlteration, SelectionDirection, TextGranularity); 300 302 #if HAVE(ACCESSIBILITY) 301 void notifyAccessibilityForSelectionChange( );303 void notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&); 302 304 #else 303 void notifyAccessibilityForSelectionChange( ) { }305 void notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&) { } 304 306 #endif 305 307 … … 368 370 #if !(PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(EFL)) 369 371 #if HAVE(ACCESSIBILITY) 370 inline void FrameSelection::notifyAccessibilityForSelectionChange( )372 inline void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&) 371 373 { 372 374 } -
trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
r183283 r183368 40 40 namespace WebCore { 41 41 42 InsertIntoTextNodeCommand::InsertIntoTextNodeCommand( PassRefPtr<Text> node, unsigned offset, const String& text)43 : SimpleEditCommand(node->document() )42 InsertIntoTextNodeCommand::InsertIntoTextNodeCommand(RefPtr<Text>&& node, unsigned offset, const String& text, EditAction editingAction) 43 : SimpleEditCommand(node->document(), editingAction) 44 44 , m_node(node) 45 45 , m_offset(offset) … … 67 67 m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION); 68 68 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))); 71 71 } 72 72 … … 85 85 86 86 // 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))); 89 89 90 90 m_node->deleteData(m_offset, m_text.length(), IGNORE_EXCEPTION); -
trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.h
r183283 r183368 35 35 class InsertIntoTextNodeCommand : public SimpleEditCommand { 36 36 public: 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) 38 38 { 39 return adoptRef(*new InsertIntoTextNodeCommand( node, offset, text));39 return adoptRef(*new InsertIntoTextNodeCommand(WTF::move(node), offset, text, editingAction)); 40 40 } 41 41 42 const String& insertedText(); 43 44 protected: 45 InsertIntoTextNodeCommand(RefPtr<Text>&& node, unsigned offset, const String& text, EditAction editingAction); 46 42 47 private: 43 InsertIntoTextNodeCommand(PassRefPtr<Text> node, unsigned offset, const String& text);44 45 48 virtual void doApply() override; 46 49 virtual void doUnapply() override; … … 58 61 }; 59 62 63 inline const String& InsertIntoTextNodeCommand::insertedText() 64 { 65 return m_text; 66 } 67 60 68 } // namespace WebCore 61 69 -
trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp
r183283 r183368 30 30 #include "Document.h" 31 31 #include "ExceptionCodePlaceholder.h" 32 #include "Text.h" 32 33 #include "htmlediting.h" 33 34 34 35 namespace WebCore { 35 36 36 InsertNodeBeforeCommand::InsertNodeBeforeCommand(PassRefPtr<Node> insertChild, PassRefPtr<Node> refChild, 37 ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) 38 : SimpleEditCommand(refChild->document()) 37 InsertNodeBeforeCommand::InsertNodeBeforeCommand(RefPtr<Node>&& insertChild, RefPtr<Node>&& refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction) 38 : SimpleEditCommand(refChild->document(), editingAction) 39 39 , m_insertChild(insertChild) 40 40 , m_refChild(refChild) … … 58 58 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION); 59 59 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 } 62 64 } 63 65 … … 68 70 69 71 // 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 } 72 76 73 77 m_insertChild->remove(IGNORE_EXCEPTION); -
trunk/Source/WebCore/editing/InsertNodeBeforeCommand.h
r183283 r183368 33 33 class InsertNodeBeforeCommand : public SimpleEditCommand { 34 34 public: 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) 37 37 { 38 return adoptRef(*new InsertNodeBeforeCommand( childToInsert, childToInsertBefore, shouldAssumeContentIsAlwaysEditable));38 return adoptRef(*new InsertNodeBeforeCommand(WTF::move(childToInsert), WTF::move(childToInsertBefore), shouldAssumeContentIsAlwaysEditable, editingAction)); 39 39 } 40 40 41 protected: 42 InsertNodeBeforeCommand(RefPtr<Node>&& childToInsert, RefPtr<Node>&& childToInsertBefore, ShouldAssumeContentIsAlwaysEditable, EditAction); 43 41 44 private: 42 InsertNodeBeforeCommand(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore, ShouldAssumeContentIsAlwaysEditable);43 44 45 virtual void doApply() override; 45 46 virtual void doUnapply() override; 46 47 47 48 #ifndef NDEBUG 48 49 virtual void getNodesInCommand(HashSet<Node*>&) override; 49 50 #endif 50 51 51 52 RefPtr<Node> m_insertChild; 52 53 RefPtr<Node> m_refChild; -
trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp
r183283 r183368 60 60 } 61 61 62 InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document& document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea )63 : CompositeEditCommand(document )62 InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document& document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea, EditAction editingAction) 63 : CompositeEditCommand(document, editingAction) 64 64 , m_mustUseDefaultParagraphElement(mustUseDefaultParagraphElement) 65 65 , m_pasteBlockqutoeIntoUnquotedArea(pasteBlockqutoeIntoUnquotedArea) -
trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.h
r183283 r183368 35 35 class InsertParagraphSeparatorCommand : public CompositeEditCommand { 36 36 public: 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) 38 38 { 39 return adoptRef(*new InsertParagraphSeparatorCommand(document, useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea ));39 return adoptRef(*new InsertParagraphSeparatorCommand(document, useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea, editingAction)); 40 40 } 41 41 42 42 private: 43 InsertParagraphSeparatorCommand(Document&, bool useDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea );43 InsertParagraphSeparatorCommand(Document&, bool useDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea, EditAction); 44 44 45 45 virtual void doApply(); -
trunk/Source/WebCore/editing/InsertTextCommand.cpp
r183283 r183368 38 38 namespace WebCore { 39 39 40 InsertTextCommand::InsertTextCommand(Document& document, const String& text, bool selectInsertedText, RebalanceType rebalanceType )41 : CompositeEditCommand(document )40 InsertTextCommand::InsertTextCommand(Document& document, const String& text, bool selectInsertedText, RebalanceType rebalanceType, EditAction editingAction) 41 : CompositeEditCommand(document, editingAction) 42 42 , m_text(text) 43 43 , m_selectInsertedText(selectInsertedText) … … 46 46 } 47 47 48 InsertTextCommand::InsertTextCommand(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier )49 : CompositeEditCommand(document )48 InsertTextCommand::InsertTextCommand(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier, EditAction editingAction) 49 : CompositeEditCommand(document, editingAction) 50 50 , m_text(text) 51 51 , m_selectInsertedText(false) -
trunk/Source/WebCore/editing/InsertTextCommand.h
r183283 r183368 50 50 51 51 static Ref<InsertTextCommand> create(Document& document, const String& text, bool selectInsertedText = false, 52 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces )52 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces, EditAction editingAction = EditActionInsert) 53 53 { 54 return adoptRef(*new InsertTextCommand(document, text, selectInsertedText, rebalanceType ));54 return adoptRef(*new InsertTextCommand(document, text, selectInsertedText, rebalanceType, editingAction)); 55 55 } 56 56 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) 58 58 { 59 return adoptRef(*new InsertTextCommand(document, text, markerSupplier ));59 return adoptRef(*new InsertTextCommand(document, text, markerSupplier, editingAction)); 60 60 } 61 61 62 protected: 63 InsertTextCommand(Document&, const String& text, PassRefPtr<TextInsertionMarkerSupplier>, EditAction); 64 InsertTextCommand(Document&, const String& text, bool selectInsertedText, RebalanceType, EditAction); 65 62 66 private: 63 64 InsertTextCommand(Document&, const String& text, bool selectInsertedText, RebalanceType);65 InsertTextCommand(Document&, const String& text, PassRefPtr<TextInsertionMarkerSupplier>);66 67 67 68 void deleteCharacter(); -
trunk/Source/WebCore/editing/MoveSelectionCommand.cpp
r183283 r183368 80 80 if (m_smartInsert) 81 81 options |= ReplaceSelectionCommand::SmartReplace; 82 applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragment, options));82 applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTF::move(m_fragment), options)); 83 83 } 84 84 -
trunk/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp
r183283 r183368 32 32 namespace WebCore { 33 33 34 RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable )35 : CompositeEditCommand(node->document() )34 RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction) 35 : CompositeEditCommand(node->document(), editingAction) 36 36 , m_node(node) 37 37 , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable) -
trunk/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.h
r183283 r183368 33 33 class RemoveNodePreservingChildrenCommand : public CompositeEditCommand { 34 34 public: 35 static Ref<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable )35 static Ref<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction) 36 36 { 37 return adoptRef(*new RemoveNodePreservingChildrenCommand(node, shouldAssumeContentIsAlwaysEditable ));37 return adoptRef(*new RemoveNodePreservingChildrenCommand(node, shouldAssumeContentIsAlwaysEditable, editingAction)); 38 38 } 39 39 40 40 private: 41 explicit RemoveNodePreservingChildrenCommand(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable );41 explicit RemoveNodePreservingChildrenCommand(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable, EditAction); 42 42 43 43 virtual void doApply(); -
trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.cpp
r183367 r183368 1 1 /* 2 * Copyright (C) 20 05, 2006, 2008 Apple Inc.All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i fndef AppendNodeCommand_h27 # define AppendNodeCommand_h26 #include "config.h" 27 #include "ReplaceDeleteFromTextNodeCommand.h" 28 28 29 #include " EditCommand.h"29 #include "Text.h" 30 30 31 31 namespace WebCore { 32 33 ReplaceDeleteFromTextNodeCommand::ReplaceDeleteFromTextNodeCommand(RefPtr<Text>&& text, unsigned offset, unsigned count) 34 : DeleteFromTextNodeCommand(WTF::move(text), offset, count, EditActionDelete) 35 { 36 } 32 37 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 }; 38 void ReplaceDeleteFromTextNodeCommand::notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&) 39 { 40 } 53 41 54 42 } // namespace WebCore 55 56 #endif // AppendNodeCommand_h -
trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.h
r183367 r183368 1 1 /* 2 * Copyright (C) 20 05, 2006, 2008Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef AppendNodeCommand_h27 #define AppendNodeCommand_h26 #ifndef ReplaceDeleteFromTextNodeCommand_h 27 #define ReplaceDeleteFromTextNodeCommand_h 28 28 29 #include " EditCommand.h"29 #include "DeleteFromTextNodeCommand.h" 30 30 31 31 namespace WebCore { 32 32 33 class AppendNodeCommand : public SimpleEditCommand {33 class ReplaceDeleteFromTextNodeCommand final : public DeleteFromTextNodeCommand { 34 34 public: 35 static Ref< AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node)35 static Ref<ReplaceDeleteFromTextNodeCommand> create(RefPtr<Text>&& text, unsigned offset, unsigned count) 36 36 { 37 return adoptRef(*new AppendNodeCommand(parent, node));37 return adoptRef(*new ReplaceDeleteFromTextNodeCommand(WTF::move(text), offset, count)); 38 38 } 39 39 40 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; 41 ReplaceDeleteFromTextNodeCommand(RefPtr<Text>&&, unsigned, unsigned); 42 virtual void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&, const VisiblePosition&) override; 52 43 }; 53 44 54 45 } // namespace WebCore 55 46 56 #endif // AppendNodeCommand_h47 #endif // ReplaceDeleteFromTextNodeCommand_h -
trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.h
r183367 r183368 1 1 /* 2 * Copyright (C) 20 05, 2006, 2008Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef Re moveNodePreservingChildrenCommand_h27 #define Re moveNodePreservingChildrenCommand_h26 #ifndef ReplaceInsertIntoTextNodeCommand_h 27 #define ReplaceInsertIntoTextNodeCommand_h 28 28 29 #include " CompositeEditCommand.h"29 #include "InsertIntoTextNodeCommand.h" 30 30 31 31 namespace WebCore { 32 32 33 class Re moveNodePreservingChildrenCommand : public CompositeEditCommand {33 class ReplaceInsertIntoTextNodeCommand final : public InsertIntoTextNodeCommand { 34 34 public: 35 static Ref<Re moveNodePreservingChildrenCommand> create(PassRefPtr<Node> node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)35 static Ref<ReplaceInsertIntoTextNodeCommand> create(RefPtr<Text>&& node, unsigned offset, const String& text, const String& deletedText, EditAction editingAction) 36 36 { 37 return adoptRef(*new Re moveNodePreservingChildrenCommand(node, shouldAssumeContentIsAlwaysEditable));37 return adoptRef(*new ReplaceInsertIntoTextNodeCommand(WTF::move(node), offset, text, deletedText, editingAction)); 38 38 } 39 39 40 40 private: 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; 42 43 43 virtual void doApply(); 44 45 RefPtr<Node> m_node; 46 ShouldAssumeContentIsAlwaysEditable m_shouldAssumeContentIsAlwaysEditable; 44 String m_deletedText; 47 45 }; 48 46 49 47 } // namespace WebCore 50 48 51 #endif // Re moveNodePreservingChildrenCommand_h49 #endif // ReplaceInsertIntoTextNodeCommand_h -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp
r183283 r183368 48 48 #include "RenderObject.h" 49 49 #include "RenderText.h" 50 #include "ReplaceDeleteFromTextNodeCommand.h" 51 #include "ReplaceInsertIntoTextNodeCommand.h" 50 52 #include "SimplifyMarkupCommand.h" 51 53 #include "SmartReplace.h" … … 369 371 } 370 372 371 ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, PassRefPtr<DocumentFragment>fragment, CommandOptions options, EditAction editAction)372 : CompositeEditCommand(document )373 ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, RefPtr<DocumentFragment>&& fragment, CommandOptions options, EditAction editAction) 374 : CompositeEditCommand(document, editAction) 373 375 , m_selectReplacement(options & SelectReplacement) 374 376 , m_smartReplace(options & SmartReplace) … … 377 379 , m_preventNesting(options & PreventNesting) 378 380 , m_movingParagraph(options & MovingParagraph) 379 , m_editAction(editAction)380 381 , m_sanitizeFragment(options & SanitizeFragment) 381 382 , m_shouldMergeEnd(false) … … 1428 1429 } 1429 1430 1430 EditAction ReplaceSelectionCommand::editingAction() const1431 {1432 return m_editAction;1433 }1434 1435 1431 // If the user is inserting a list into an existing list, instead of nesting the list, 1436 1432 // we put the list items into the existing list. -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.h
r183283 r183368 49 49 typedef unsigned CommandOptions; 50 50 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) 52 52 { 53 return adoptRef(*new ReplaceSelectionCommand(document, fragment, options, action));53 return adoptRef(*new ReplaceSelectionCommand(document, WTF::move(fragment), options, editingAction)); 54 54 } 55 55 56 56 private: 57 ReplaceSelectionCommand(Document&, PassRefPtr<DocumentFragment>, CommandOptions, EditAction);57 ReplaceSelectionCommand(Document&, RefPtr<DocumentFragment>&&, CommandOptions, EditAction); 58 58 59 59 virtual void doApply(); 60 virtual EditAction editingAction() const; 61 60 62 61 class InsertedNodes { 63 62 public: … … 121 120 bool m_preventNesting; 122 121 bool m_movingParagraph; 123 EditAction m_editAction;124 122 bool m_sanitizeFragment; 125 123 bool m_shouldMergeEnd; -
trunk/Source/WebCore/editing/TypingCommand.cpp
r183283 r183368 375 375 { 376 376 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); 378 378 379 379 applyCommandToComposite(command, endingSelection()); … … 396 396 return; 397 397 398 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document() ));398 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), false, false, EditActionTyping)); 399 399 typingAddedToOpenCommand(InsertParagraphSeparator); 400 400 } -
trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp
r183283 r183368 79 79 80 80 81 void FrameSelection::notifyAccessibilityForSelectionChange( )81 void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&) 82 82 { 83 83 if (!AXObjectCache::accessibilityEnabled()) -
trunk/Source/WebCore/editing/ios/DictationCommandIOS.cpp
r183283 r183368 39 39 40 40 DictationCommandIOS::DictationCommandIOS(Document& document, Vector<Vector<String>>&& dictationPhrases, RetainPtr<id> metadata) 41 : CompositeEditCommand(document )41 : CompositeEditCommand(document, EditActionDictation) 42 42 , m_dictationPhrases(WTF::move(dictationPhrases)) 43 43 , m_metadata(WTF::move(metadata)) -
trunk/Source/WebCore/editing/ios/DictationCommandIOS.h
r183283 r183368 45 45 46 46 virtual void doApply() override; 47 virtual EditAction editingAction() const override { return EditActionDictation; }48 47 49 48 Vector<Vector<String>> m_dictationPhrases; -
trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm
r183283 r183368 48 48 49 49 50 void FrameSelection::notifyAccessibilityForSelectionChange( )50 void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent& intent) 51 51 { 52 52 Document* document = m_frame->document(); … … 54 54 if (m_selection.start().isNotNull() && m_selection.end().isNotNull()) { 55 55 if (AXObjectCache* cache = document->existingAXObjectCache()) 56 cache->post Notification(m_selection.start().deprecatedNode()->renderer(), AXObjectCache::AXSelectedTextChanged, TargetObservableParent);56 cache->postTextStateChangeNotification(m_selection.start().deprecatedNode(), intent, m_selection); 57 57 } 58 58 -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r183283 r183368 549 549 550 550 ASSERT(isTextFormControl()); 551 bool textIsChanged = value != innerTextValueFrom(*innerText); 551 String previousValue = innerTextValueFrom(*innerText); 552 bool textIsChanged = value != previousValue; 552 553 if (textIsChanged || !innerText->hasChildNodes()) { 554 #if HAVE(ACCESSIBILITY) && !PLATFORM(COCOA) 553 555 if (textIsChanged && renderer()) { 554 556 if (AXObjectCache* cache = document().existingAXObjectCache()) 555 557 cache->postNotification(this, AXObjectCache::AXValueChanged, TargetObservableParent); 556 558 } 559 #endif 557 560 innerText->setInnerText(value, ASSERT_NO_EXCEPTION); 558 561 559 562 if (value.endsWith('\n') || value.endsWith('\r')) 560 563 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 561 571 } 562 572 -
trunk/Source/WebCore/page/DragController.cpp
r183283 r183368 525 525 if (chosePlainText) 526 526 options |= ReplaceSelectionCommand::MatchStyle; 527 applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse, fragment, options));527 applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse, WTF::move(fragment), options)); 528 528 } 529 529 } -
trunk/Source/WebCore/page/EventHandler.cpp
r183283 r183368 3240 3240 } 3241 3241 3242 selection.setSelection(visiblePosition, FrameSelection::defaultSetSelectionOptions(UserTriggered)); 3242 AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown }); 3243 selection.setSelection(visiblePosition, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent); 3243 3244 } 3244 3245 -
trunk/Source/WebCore/page/FocusController.cpp
r183283 r183368 341 341 Position position = firstPositionInOrBeforeNode(element.get()); 342 342 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 } 345 347 } 346 348 -
trunk/Source/WebKit/mac/ChangeLog
r183336 r183368 1 2015-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 1 22 2015-04-24 Timothy Hatcher <timothy@apple.com> 2 23 -
trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
r183283 r183368 547 547 switch (editAction) { 548 548 case EditActionUnspecified: return nil; 549 case EditActionInsert: return nil; 549 550 case EditActionSetColor: return UI_STRING_KEY_INTERNAL("Set Color", "Set Color (Undo action name)", "Undo action name"); 550 551 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 1 2015-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 1 22 2015-04-26 Dan Bernstein <mitz@apple.com> 2 23 -
trunk/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
r183283 r183368 74 74 switch (editAction) { 75 75 case EditActionUnspecified: 76 return String(); 77 case EditActionInsert: 76 78 return String(); 77 79 case EditActionSetColor: -
trunk/Tools/ChangeLog
r183344 r183368 1 2015-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 1 30 2015-04-25 Sungmann Cho <sungmann.cho@navercorp.com> 2 31 -
trunk/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.h
r183283 r183368 43 43 - (void)setCallback:(JSObjectRef)callback; 44 44 - (void)startObserving; 45 - (void)stopObserving; 45 46 46 47 @end -
trunk/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm
r183283 r183368 105 105 } 106 106 107 - (void)stopObserving 108 { 109 [[NSNotificationCenter defaultCenter] removeObserver:self]; 110 } 111 107 112 - (void)_notificationReceived:(NSNotification *)notification 108 113 { … … 113 118 return; 114 119 120 NSString *userInfoJSONValue = notification.userInfo[@"userInfo"]; 121 115 122 JSRetainPtr<JSStringRef> jsNotification(Adopt, [notificationName createJSStringRef]); 116 123 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 } 117 129 if (m_platformElement) { 118 // Listener for one element just gets one argument, the notification name. 119 JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 1, ¬ificationNameArgument, 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); 120 135 } 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]; 123 138 arguments[0] = AccessibilityUIElement::makeJSAccessibilityUIElement([mainFrame globalContext], AccessibilityUIElement([notification object])); 124 139 arguments[1] = notificationNameArgument; 140 arguments[2] = userInfoJSONValueArgument; 125 141 JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 2, arguments, 0); 126 142 } -
trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
r183283 r183368 1447 1447 ASSERT(m_notificationHandler); 1448 1448 1449 [m_notificationHandler stopObserving]; 1449 1450 [m_notificationHandler release]; 1450 1451 m_notificationHandler = nil; -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm
r183283 r183368 126 126 return; 127 127 128 NSString *userInfoJSONValue = notification.userInfo[@"userInfo"]; 129 128 130 WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(WTR::InjectedBundle::singleton().page()->page()); 129 131 JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); … … 131 133 JSRetainPtr<JSStringRef> jsNotification(Adopt, [notificationName createJSStringRef]); 132 134 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 } 133 140 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, ¬ificationNameArgument, 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); 136 146 } 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]; 139 149 arguments[0] = toJS(context, WTF::getPtr(WTR::AccessibilityUIElement::create([notification object]))); 140 150 arguments[1] = notificationNameArgument; 151 arguments[2] = userInfoJSONValueArgument; 141 152 JSObjectCallAsFunction(context, const_cast<JSObjectRef>(m_notificationFunctionCallback), 0, 2, arguments, 0); 142 153 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
r183283 r183368 1477 1477 ASSERT(m_notificationHandler); 1478 1478 1479 [m_notificationHandler stopObserving]; 1479 1480 [m_notificationHandler release]; 1480 1481 m_notificationHandler = nil;
Note: See TracChangeset
for help on using the changeset viewer.