OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2009 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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 if (child == targetNode || child->contains(targetNode)) | 1060 if (child == targetNode || child->contains(targetNode)) |
1061 current = child; | 1061 current = child; |
1062 } | 1062 } |
1063 } | 1063 } |
1064 } | 1064 } |
1065 | 1065 |
1066 void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &s
tart, const Position &end) | 1066 void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &s
tart, const Position &end) |
1067 { | 1067 { |
1068 ASSERT(start.isNotNull()); | 1068 ASSERT(start.isNotNull()); |
1069 ASSERT(end.isNotNull()); | 1069 ASSERT(end.isNotNull()); |
1070 ASSERT(start.anchorNode()->inDocument()); | 1070 ASSERT(start.inDocument()); |
1071 ASSERT(end.anchorNode()->inDocument()); | 1071 ASSERT(end.inDocument()); |
1072 ASSERT(comparePositions(start, end) <= 0); | 1072 ASSERT(comparePositions(start, end) <= 0); |
1073 // FIXME: We should assert that start/end are not in the middle of a text no
de. | 1073 // FIXME: We should assert that start/end are not in the middle of a text no
de. |
1074 | 1074 |
1075 Position pushDownStart = start.downstream(); | 1075 Position pushDownStart = start.downstream(); |
1076 // If the pushDownStart is at the end of a text node, then this node is not
fully selected. | 1076 // If the pushDownStart is at the end of a text node, then this node is not
fully selected. |
1077 // Move it to the next deep quivalent position to avoid removing the style f
rom this node. | 1077 // Move it to the next deep quivalent position to avoid removing the style f
rom this node. |
1078 // e.g. if pushDownStart was at Position("hello", 5) in <b>hello<div>world</
div></b>, we want Position("world", 0) instead. | 1078 // e.g. if pushDownStart was at Position("hello", 5) in <b>hello<div>world</
div></b>, we want Position("world", 0) instead. |
1079 Node* pushDownStartContainer = pushDownStart.containerNode(); | 1079 Node* pushDownStartContainer = pushDownStart.containerNode(); |
1080 if (pushDownStartContainer && pushDownStartContainer->isTextNode() | 1080 if (pushDownStartContainer && pushDownStartContainer->isTextNode() |
1081 && pushDownStart.computeOffsetInContainerNode() == pushDownStartContaine
r->maxCharacterOffset()) | 1081 && pushDownStart.computeOffsetInContainerNode() == pushDownStartContaine
r->maxCharacterOffset()) |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 String textToMove = nextText->data(); | 1541 String textToMove = nextText->data(); |
1542 insertTextIntoNode(childText, childText->length(), textToMove); | 1542 insertTextIntoNode(childText, childText->length(), textToMove); |
1543 removeNode(next); | 1543 removeNode(next); |
1544 // don't move child node pointer. it may want to merge with more text no
des. | 1544 // don't move child node pointer. it may want to merge with more text no
des. |
1545 } | 1545 } |
1546 | 1546 |
1547 updateStartEnd(newStart, newEnd); | 1547 updateStartEnd(newStart, newEnd); |
1548 } | 1548 } |
1549 | 1549 |
1550 } | 1550 } |
OLD | NEW |