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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "core/editing/htmlediting.h" | 62 #include "core/editing/htmlediting.h" |
63 #include "core/editing/markup.h" | 63 #include "core/editing/markup.h" |
64 #include "core/events/ScopedEventQueue.h" | 64 #include "core/events/ScopedEventQueue.h" |
65 #include "core/frame/LocalFrame.h" | 65 #include "core/frame/LocalFrame.h" |
66 #include "core/html/HTMLElement.h" | 66 #include "core/html/HTMLElement.h" |
67 #include "core/rendering/InlineTextBox.h" | 67 #include "core/rendering/InlineTextBox.h" |
68 #include "core/rendering/RenderBlock.h" | 68 #include "core/rendering/RenderBlock.h" |
69 #include "core/rendering/RenderListItem.h" | 69 #include "core/rendering/RenderListItem.h" |
70 #include "core/rendering/RenderText.h" | 70 #include "core/rendering/RenderText.h" |
71 | 71 |
| 72 using namespace std; |
| 73 |
72 namespace WebCore { | 74 namespace WebCore { |
73 | 75 |
74 using namespace HTMLNames; | 76 using namespace HTMLNames; |
75 | 77 |
76 PassRefPtrWillBeRawPtr<EditCommandComposition> EditCommandComposition::create(Do
cument* document, | 78 PassRefPtrWillBeRawPtr<EditCommandComposition> EditCommandComposition::create(Do
cument* document, |
77 const VisibleSelection& startingSelection, const VisibleSelection& endingSel
ection, EditAction editAction) | 79 const VisibleSelection& startingSelection, const VisibleSelection& endingSel
ection, EditAction editAction) |
78 { | 80 { |
79 return adoptRefWillBeNoop(new EditCommandComposition(document, startingSelec
tion, endingSelection, editAction)); | 81 return adoptRefWillBeNoop(new EditCommandComposition(document, startingSelec
tion, endingSelection, editAction)); |
80 } | 82 } |
81 | 83 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 while (prevBox || box) { | 755 while (prevBox || box) { |
754 unsigned gapStart = prevBox ? prevBox->start() + prevBox->len() : 0; | 756 unsigned gapStart = prevBox ? prevBox->start() + prevBox->len() : 0; |
755 if (end < gapStart) | 757 if (end < gapStart) |
756 // No more chance for any intersections | 758 // No more chance for any intersections |
757 break; | 759 break; |
758 | 760 |
759 unsigned gapEnd = box ? box->start() : length; | 761 unsigned gapEnd = box ? box->start() : length; |
760 bool indicesIntersect = start <= gapEnd && end >= gapStart; | 762 bool indicesIntersect = start <= gapEnd && end >= gapStart; |
761 int gapLen = gapEnd - gapStart; | 763 int gapLen = gapEnd - gapStart; |
762 if (indicesIntersect && gapLen > 0) { | 764 if (indicesIntersect && gapLen > 0) { |
763 gapStart = std::max(gapStart, start); | 765 gapStart = max(gapStart, start); |
764 if (str.isNull()) | 766 if (str.isNull()) |
765 str = textNode->data().substring(start, end - start); | 767 str = textNode->data().substring(start, end - start); |
766 // remove text in the gap | 768 // remove text in the gap |
767 str.remove(gapStart - start - removed, gapLen); | 769 str.remove(gapStart - start - removed, gapLen); |
768 removed += gapLen; | 770 removed += gapLen; |
769 } | 771 } |
770 | 772 |
771 prevBox = box; | 773 prevBox = box; |
772 if (box) { | 774 if (box) { |
773 if (++sortedTextBoxesPosition < sortedTextBoxes.size()) | 775 if (++sortedTextBoxesPosition < sortedTextBoxes.size()) |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 } | 1497 } |
1496 | 1498 |
1497 void CompositeEditCommand::trace(Visitor* visitor) | 1499 void CompositeEditCommand::trace(Visitor* visitor) |
1498 { | 1500 { |
1499 visitor->trace(m_commands); | 1501 visitor->trace(m_commands); |
1500 visitor->trace(m_composition); | 1502 visitor->trace(m_composition); |
1501 EditCommand::trace(visitor); | 1503 EditCommand::trace(visitor); |
1502 } | 1504 } |
1503 | 1505 |
1504 } // namespace WebCore | 1506 } // namespace WebCore |
OLD | NEW |