ReplaceInsertIntoTextNodeCommand.cpp [plain text]
#include "config.h"
#include "ReplaceInsertIntoTextNodeCommand.h"
#include "AXObjectCache.h"
#include "Document.h"
#include "Text.h"
namespace WebCore {
ReplaceInsertIntoTextNodeCommand::ReplaceInsertIntoTextNodeCommand(RefPtr<Text>&& node, unsigned offset, const String& text, const String& deletedText, EditAction editingAction)
: InsertIntoTextNodeCommand(WTF::move(node), offset, text, editingAction)
, m_deletedText(deletedText)
{
}
void ReplaceInsertIntoTextNodeCommand::notifyAccessibilityForTextChange(Node* node, AXTextEditType type, const String& text, const VisiblePosition& position)
{
if (!shouldPostAccessibilityNotification())
return;
AXObjectCache* cache = document().existingAXObjectCache();
if (!cache)
return;
switch (type) {
case AXTextEditTypeAttributesChange:
case AXTextEditTypeCut:
case AXTextEditTypeUnknown:
break;
case AXTextEditTypeDelete:
cache->postTextReplacementNotification(node, AXTextEditTypeDelete, text, AXTextEditTypeInsert, m_deletedText, position);
break;
case AXTextEditTypeDictation:
case AXTextEditTypeInsert:
case AXTextEditTypePaste:
case AXTextEditTypeTyping:
cache->postTextReplacementNotification(node, AXTextEditTypeDelete, m_deletedText, type, text, position);
break;
}
}
}