示例#1
0
void AppendNodeCommand::doApply()
{
    if (!m_parent->hasEditableStyle() && m_parent->renderer())
        return;

    m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION);

    sendAXTextChangedIgnoringLineBreaks(m_node.get(), applyEditType());
}
void InsertNodeBeforeCommand::doApply()
{
    ContainerNode* parent = m_refChild->parentNode();
    if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentIsAlwaysEditable && !isEditableNode(*parent)))
        return;
    ASSERT(isEditableNode(*parent));

    parent->insertBefore(*m_insertChild, m_refChild.get(), IGNORE_EXCEPTION);

    if (shouldPostAccessibilityNotification()) {
        Position position = is<Text>(m_insertChild.get()) ? Position(downcast<Text>(m_insertChild.get()), 0) : createLegacyEditingPosition(m_insertChild.get(), 0);
        notifyAccessibilityForTextChange(m_insertChild.get(), applyEditType(), m_insertChild->nodeValue(), VisiblePosition(position));
    }
}
示例#3
0
AXTextEditType EditCommand::unapplyEditType() const
{
    switch (applyEditType()) {
    case AXTextEditTypeUnknown:
        return AXTextEditTypeUnknown;
    case AXTextEditTypeDelete:
    case AXTextEditTypeCut:
        return AXTextEditTypeInsert;
    case AXTextEditTypeInsert:
    case AXTextEditTypeTyping:
    case AXTextEditTypeDictation:
    case AXTextEditTypePaste:
        return AXTextEditTypeDelete;
    }
    return AXTextEditTypeUnknown;
}