OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 VisiblePosition visibleStart = endingSelection().visibleStart(); | 65 VisiblePosition visibleStart = endingSelection().visibleStart(); |
66 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull()
|| visibleEnd.isOrphan()) | 66 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull()
|| visibleEnd.isOrphan()) |
67 return; | 67 return; |
68 | 68 |
69 // When a selection ends at the start of a paragraph, we rarely paint | 69 // When a selection ends at the start of a paragraph, we rarely paint |
70 // the selection gap before that paragraph, because there often is no gap. | 70 // the selection gap before that paragraph, because there often is no gap. |
71 // In a case like this, it's not obvious to the user that the selection | 71 // In a case like this, it's not obvious to the user that the selection |
72 // ends "inside" that paragraph, so it would be confusing if Indent/Outdent | 72 // ends "inside" that paragraph, so it would be confusing if Indent/Outdent |
73 // operated on that paragraph. | 73 // operated on that paragraph. |
74 // FIXME: We paint the gap before some paragraphs that are indented with lef
t | 74 // FIXME: We paint the gap before some paragraphs that are indented with lef
t |
75 // margin/padding, but not others. We should make the gap painting more con
sistent and | 75 // margin/padding, but not others. We should make the gap painting more |
76 // then use a left margin/padding rule here. | 76 // consistent and then use a left margin/padding rule here. |
77 if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() && isStartO
fParagraph(visibleEnd)) { | 77 if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() && isStartO
fParagraph(visibleEnd)) { |
78 VisibleSelection newSelection(visibleStart, visibleEnd.previous(CannotCr
ossEditingBoundary), endingSelection().isDirectional()); | 78 VisibleSelection newSelection(visibleStart, previousPositionOf(visibleEn
d, CannotCrossEditingBoundary), endingSelection().isDirectional()); |
79 if (newSelection.isNone()) | 79 if (newSelection.isNone()) |
80 return; | 80 return; |
81 setEndingSelection(newSelection); | 81 setEndingSelection(newSelection); |
82 } | 82 } |
83 | 83 |
84 VisibleSelection selection = selectionForParagraphIteration(endingSelection(
)); | 84 VisibleSelection selection = selectionForParagraphIteration(endingSelection(
)); |
85 VisiblePosition startOfSelection = selection.visibleStart(); | 85 VisiblePosition startOfSelection = selection.visibleStart(); |
86 VisiblePosition endOfSelection = selection.visibleEnd(); | 86 VisiblePosition endOfSelection = selection.visibleEnd(); |
87 ASSERT(!startOfSelection.isNull()); | 87 ASSERT(!startOfSelection.isNull()); |
88 ASSERT(!endOfSelection.isNull()); | 88 ASSERT(!endOfSelection.isNull()); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return element.release(); | 294 return element.release(); |
295 } | 295 } |
296 | 296 |
297 DEFINE_TRACE(ApplyBlockElementCommand) | 297 DEFINE_TRACE(ApplyBlockElementCommand) |
298 { | 298 { |
299 visitor->trace(m_endOfLastParagraph); | 299 visitor->trace(m_endOfLastParagraph); |
300 CompositeEditCommand::trace(visitor); | 300 CompositeEditCommand::trace(visitor); |
301 } | 301 } |
302 | 302 |
303 } | 303 } |
OLD | NEW |