OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 RefPtr<Range> range = VisibleSelection::selectionFromContentsOfNode(holder.g
et()).toNormalizedRange(); | 168 RefPtr<Range> range = VisibleSelection::selectionFromContentsOfNode(holder.g
et()).toNormalizedRange(); |
169 String text = plainText(range.get(), static_cast<TextIteratorBehavior>(TextI
teratorEmitsOriginalText | TextIteratorIgnoresStyleVisibility)); | 169 String text = plainText(range.get(), static_cast<TextIteratorBehavior>(TextI
teratorEmitsOriginalText | TextIteratorIgnoresStyleVisibility)); |
170 | 170 |
171 removeInterchangeNodes(holder.get()); | 171 removeInterchangeNodes(holder.get()); |
172 removeUnrenderedNodes(holder.get()); | 172 removeUnrenderedNodes(holder.get()); |
173 restoreAndRemoveTestRenderingNodesToFragment(holder.get()); | 173 restoreAndRemoveTestRenderingNodesToFragment(holder.get()); |
174 | 174 |
175 // Give the root a chance to change the text. | 175 // Give the root a chance to change the text. |
176 RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text); | 176 RefPtrWillBeRawPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::c
reate(text); |
177 editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION); | 177 editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION); |
178 if (text != evt->text() || !editableRoot->rendererIsRichlyEditable()) { | 178 if (text != evt->text() || !editableRoot->rendererIsRichlyEditable()) { |
179 restoreAndRemoveTestRenderingNodesToFragment(holder.get()); | 179 restoreAndRemoveTestRenderingNodesToFragment(holder.get()); |
180 | 180 |
181 m_fragment = createFragmentFromText(selection.toNormalizedRange().get(),
evt->text()); | 181 m_fragment = createFragmentFromText(selection.toNormalizedRange().get(),
evt->text()); |
182 if (!m_fragment->firstChild()) | 182 if (!m_fragment->firstChild()) |
183 return; | 183 return; |
184 | 184 |
185 holder = insertFragmentForTestRendering(editableRoot.get()); | 185 holder = insertFragmentForTestRendering(editableRoot.get()); |
186 removeInterchangeNodes(holder.get()); | 186 removeInterchangeNodes(holder.get()); |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1495 | 1495 |
1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1497 | 1497 |
1498 setEndingSelection(selectionAfterReplace); | 1498 setEndingSelection(selectionAfterReplace); |
1499 | 1499 |
1500 return true; | 1500 return true; |
1501 } | 1501 } |
1502 | 1502 |
1503 } // namespace WebCore | 1503 } // namespace WebCore |
OLD | NEW |