| 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 25 matching lines...) Expand all Loading... |
| 36 : SimpleEditCommand(refChild->document()) | 36 : SimpleEditCommand(refChild->document()) |
| 37 , m_insertChild(insertChild) | 37 , m_insertChild(insertChild) |
| 38 , m_refChild(refChild) | 38 , m_refChild(refChild) |
| 39 , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable) | 39 , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable) |
| 40 { | 40 { |
| 41 ASSERT(m_insertChild); | 41 ASSERT(m_insertChild); |
| 42 ASSERT(!m_insertChild->parentNode()); | 42 ASSERT(!m_insertChild->parentNode()); |
| 43 ASSERT(m_refChild); | 43 ASSERT(m_refChild); |
| 44 ASSERT(m_refChild->parentNode()); | 44 ASSERT(m_refChild->parentNode()); |
| 45 | 45 |
| 46 ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parent
Node()->attached()); | 46 ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parent
Node()->confusingAndOftenMisusedAttached()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void InsertNodeBeforeCommand::doApply() | 49 void InsertNodeBeforeCommand::doApply() |
| 50 { | 50 { |
| 51 ContainerNode* parent = m_refChild->parentNode(); | 51 ContainerNode* parent = m_refChild->parentNode(); |
| 52 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentI
sAlwaysEditable && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEdit
able))) | 52 if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentI
sAlwaysEditable && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEdit
able))) |
| 53 return; | 53 return; |
| 54 ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)); | 54 ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)); |
| 55 | 55 |
| 56 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION
); | 56 parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION
); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void InsertNodeBeforeCommand::doUnapply() | 59 void InsertNodeBeforeCommand::doUnapply() |
| 60 { | 60 { |
| 61 if (!m_insertChild->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable
)) | 61 if (!m_insertChild->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable
)) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 m_insertChild->remove(IGNORE_EXCEPTION); | 64 m_insertChild->remove(IGNORE_EXCEPTION); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } | 67 } |
| OLD | NEW |