| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 descriptions.append(markerPointer->description()); | 575 descriptions.append(markerPointer->description()); |
| 576 } | 576 } |
| 577 } | 577 } |
| 578 | 578 |
| 579 void CompositeEditCommand::replaceTextInNodePreservingMarkers(Text* node, unsign
ed offset, unsigned count, const String& replacementText) | 579 void CompositeEditCommand::replaceTextInNodePreservingMarkers(Text* node, unsign
ed offset, unsigned count, const String& replacementText) |
| 580 { | 580 { |
| 581 DocumentMarkerController& markerController = document().markers(); | 581 DocumentMarkerController& markerController = document().markers(); |
| 582 Vector<DocumentMarker::MarkerType> types; | 582 Vector<DocumentMarker::MarkerType> types; |
| 583 Vector<String> descriptions; | 583 Vector<String> descriptions; |
| 584 copyMarkerTypesAndDescriptions(markerController.markersInRange(EphemeralRang
e(Position(node, offset), Position(node, offset + count)), DocumentMarker::AllMa
rkers()), types, descriptions); | 584 copyMarkerTypesAndDescriptions(markerController.markersInRange(EphemeralRang
e(Position(node, offset), Position(node, offset + count)), DocumentMarker::AllMa
rkers()), types, descriptions); |
| 585 |
| 585 replaceTextInNode(node, offset, count, replacementText); | 586 replaceTextInNode(node, offset, count, replacementText); |
| 587 |
| 588 // Re-adding markers requires a clean tree. |
| 589 document().updateStyleAndLayout(); |
| 590 |
| 591 DocumentLifecycle::DisallowTransitionScope(document().lifecycle()); |
| 586 Position startPosition(node, offset); | 592 Position startPosition(node, offset); |
| 587 Position endPosition(node, offset + replacementText.length()); | 593 Position endPosition(node, offset + replacementText.length()); |
| 588 DCHECK_EQ(types.size(), descriptions.size()); | 594 DCHECK_EQ(types.size(), descriptions.size()); |
| 595 |
| 589 for (size_t i = 0; i < types.size(); ++i) | 596 for (size_t i = 0; i < types.size(); ++i) |
| 590 markerController.addMarker(startPosition, endPosition, types[i], descrip
tions[i]); | 597 markerController.addMarker(startPosition, endPosition, types[i], descrip
tions[i]); |
| 591 } | 598 } |
| 592 | 599 |
| 593 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos) | 600 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos) |
| 594 { | 601 { |
| 595 if (!isTabHTMLSpanElementTextNode(pos.anchorNode())) | 602 if (!isTabHTMLSpanElementTextNode(pos.anchorNode())) |
| 596 return pos; | 603 return pos; |
| 597 | 604 |
| 598 switch (pos.anchorType()) { | 605 switch (pos.anchorType()) { |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 } | 1651 } |
| 1645 | 1652 |
| 1646 DEFINE_TRACE(CompositeEditCommand) | 1653 DEFINE_TRACE(CompositeEditCommand) |
| 1647 { | 1654 { |
| 1648 visitor->trace(m_commands); | 1655 visitor->trace(m_commands); |
| 1649 visitor->trace(m_composition); | 1656 visitor->trace(m_composition); |
| 1650 EditCommand::trace(visitor); | 1657 EditCommand::trace(visitor); |
| 1651 } | 1658 } |
| 1652 | 1659 |
| 1653 } // namespace blink | 1660 } // namespace blink |
| OLD | NEW |