OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 void InsertNodeBeforeCommand::doApply() | 51 void InsertNodeBeforeCommand::doApply() |
52 { | 52 { |
53 ContainerNode* parent = m_refChild->parentNode(); | 53 ContainerNode* parent = m_refChild->parentNode(); |
54 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentI
sAlwaysEditable && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEdit
able))) | 54 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentI
sAlwaysEditable && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEdit
able))) |
55 return; | 55 return; |
56 ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)); | 56 ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)); |
57 | 57 |
58 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION
, AttachLazily); | 58 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION
, AttachLazily); |
59 | 59 |
60 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 60 if (AXObjectCache::accessibilityEnabled()) |
61 cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AX
TextInserted, 0, m_insertChild->nodeValue()); | 61 document()->axObjectCache()->nodeTextChangeNotification(m_insertChild.ge
t(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue()); |
62 } | 62 } |
63 | 63 |
64 void InsertNodeBeforeCommand::doUnapply() | 64 void InsertNodeBeforeCommand::doUnapply() |
65 { | 65 { |
66 if (!m_insertChild->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable
)) | 66 if (!m_insertChild->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable
)) |
67 return; | 67 return; |
68 | 68 |
69 // Need to notify this before actually deleting the text | 69 // Need to notify this before actually deleting the text |
70 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 70 if (AXObjectCache::accessibilityEnabled()) |
71 cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AX
TextDeleted, 0, m_insertChild->nodeValue()); | 71 document()->axObjectCache()->nodeTextChangeNotification(m_insertChild.ge
t(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue()); |
72 | 72 |
73 m_insertChild->remove(IGNORE_EXCEPTION); | 73 m_insertChild->remove(IGNORE_EXCEPTION); |
74 } | 74 } |
75 | 75 |
76 #ifndef NDEBUG | 76 #ifndef NDEBUG |
77 void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Node*>& nodes) | 77 void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Node*>& nodes) |
78 { | 78 { |
79 addNodeAndDescendants(m_insertChild.get(), nodes); | 79 addNodeAndDescendants(m_insertChild.get(), nodes); |
80 addNodeAndDescendants(m_refChild.get(), nodes); | 80 addNodeAndDescendants(m_refChild.get(), nodes); |
81 } | 81 } |
82 #endif | 82 #endif |
83 | 83 |
84 } | 84 } |
OLD | NEW |