| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parent
Node()->attached()); | 47 ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parent
Node()->attached()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void InsertNodeBeforeCommand::doApply() | 50 void InsertNodeBeforeCommand::doApply() |
| 51 { | 51 { |
| 52 ContainerNode* parent = m_refChild->parentNode(); | 52 ContainerNode* parent = m_refChild->parentNode(); |
| 53 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentI
sAlwaysEditable && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEdit
able))) | 53 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentI
sAlwaysEditable && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEdit
able))) |
| 54 return; | 54 return; |
| 55 ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)); | 55 ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)); |
| 56 | 56 |
| 57 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION
_STATE, AttachLazily); | 57 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION
, AttachLazily); |
| 58 | 58 |
| 59 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 59 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
| 60 cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AX
TextInserted, 0, m_insertChild->nodeValue()); | 60 cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AX
TextInserted, 0, m_insertChild->nodeValue()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void InsertNodeBeforeCommand::doUnapply() | 63 void InsertNodeBeforeCommand::doUnapply() |
| 64 { | 64 { |
| 65 if (!m_insertChild->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable
)) | 65 if (!m_insertChild->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable
)) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 // Need to notify this before actually deleting the text | 68 // Need to notify this before actually deleting the text |
| 69 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 69 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
| 70 cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AX
TextDeleted, 0, m_insertChild->nodeValue()); | 70 cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AX
TextDeleted, 0, m_insertChild->nodeValue()); |
| 71 | 71 |
| 72 m_insertChild->remove(IGNORE_EXCEPTION_STATE); | 72 m_insertChild->remove(IGNORE_EXCEPTION); |
| 73 } | 73 } |
| 74 | 74 |
| 75 #ifndef NDEBUG | 75 #ifndef NDEBUG |
| 76 void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Node*>& nodes) | 76 void InsertNodeBeforeCommand::getNodesInCommand(HashSet<Node*>& nodes) |
| 77 { | 77 { |
| 78 addNodeAndDescendants(m_insertChild.get(), nodes); | 78 addNodeAndDescendants(m_insertChild.get(), nodes); |
| 79 addNodeAndDescendants(m_refChild.get(), nodes); | 79 addNodeAndDescendants(m_refChild.get(), nodes); |
| 80 } | 80 } |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 } | 83 } |
| OLD | NEW |