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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 DCHECK_GT(m_text2->length(), 0u); | 44 DCHECK_GT(m_text2->length(), 0u); |
45 DCHECK_GT(m_offset, 0u); | 45 DCHECK_GT(m_offset, 0u); |
46 DCHECK_LT(m_offset, m_text2->length()); | 46 DCHECK_LT(m_offset, m_text2->length()); |
47 } | 47 } |
48 | 48 |
49 void SplitTextNodeCommand::doApply(EditingState*) { | 49 void SplitTextNodeCommand::doApply(EditingState*) { |
50 ContainerNode* parent = m_text2->parentNode(); | 50 ContainerNode* parent = m_text2->parentNode(); |
51 if (!parent || !hasEditableStyle(*parent)) | 51 if (!parent || !hasEditableStyle(*parent)) |
52 return; | 52 return; |
53 | 53 |
54 String prefixText = m_text2->substringData(0, m_offset, IGNORE_EXCEPTION); | 54 String prefixText = |
| 55 m_text2->substringData(0, m_offset, IGNORE_EXCEPTION_FOR_TESTING); |
55 if (prefixText.isEmpty()) | 56 if (prefixText.isEmpty()) |
56 return; | 57 return; |
57 | 58 |
58 m_text1 = Text::create(document(), prefixText); | 59 m_text1 = Text::create(document(), prefixText); |
59 DCHECK(m_text1); | 60 DCHECK(m_text1); |
60 document().markers().copyMarkers(m_text2.get(), 0, m_offset, m_text1.get(), | 61 document().markers().copyMarkers(m_text2.get(), 0, m_offset, m_text1.get(), |
61 0); | 62 0); |
62 | 63 |
63 insertText1AndTrimText2(); | 64 insertText1AndTrimText2(); |
64 } | 65 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 document().updateStyleAndLayout(); | 101 document().updateStyleAndLayout(); |
101 } | 102 } |
102 | 103 |
103 DEFINE_TRACE(SplitTextNodeCommand) { | 104 DEFINE_TRACE(SplitTextNodeCommand) { |
104 visitor->trace(m_text1); | 105 visitor->trace(m_text1); |
105 visitor->trace(m_text2); | 106 visitor->trace(m_text2); |
106 SimpleEditCommand::trace(visitor); | 107 SimpleEditCommand::trace(visitor); |
107 } | 108 } |
108 | 109 |
109 } // namespace blink | 110 } // namespace blink |
OLD | NEW |