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