| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 // When a selection ends at the start of a paragraph, we rarely paint | 68 // When a selection ends at the start of a paragraph, we rarely paint |
| 69 // the selection gap before that paragraph, because there often is no gap. | 69 // the selection gap before that paragraph, because there often is no gap. |
| 70 // In a case like this, it's not obvious to the user that the selection | 70 // In a case like this, it's not obvious to the user that the selection |
| 71 // ends "inside" that paragraph, so it would be confusing if Indent/Outdent | 71 // ends "inside" that paragraph, so it would be confusing if Indent/Outdent |
| 72 // operated on that paragraph. | 72 // operated on that paragraph. |
| 73 // FIXME: We paint the gap before some paragraphs that are indented with lef
t | 73 // FIXME: We paint the gap before some paragraphs that are indented with lef
t |
| 74 // margin/padding, but not others. We should make the gap painting more con
sistent and | 74 // margin/padding, but not others. We should make the gap painting more con
sistent and |
| 75 // then use a left margin/padding rule here. | 75 // then use a left margin/padding rule here. |
| 76 if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) | 76 if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) { |
| 77 setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(Ca
nnotCrossEditingBoundary), endingSelection().isDirectional())); | 77 VisibleSelection newSelection(visibleStart, visibleEnd.previous(CannotCr
ossEditingBoundary), endingSelection().isDirectional()); |
| 78 if (newSelection.isNone()) |
| 79 return; |
| 80 setEndingSelection(newSelection); |
| 81 } |
| 78 | 82 |
| 79 VisibleSelection selection = selectionForParagraphIteration(endingSelection(
)); | 83 VisibleSelection selection = selectionForParagraphIteration(endingSelection(
)); |
| 80 VisiblePosition startOfSelection = selection.visibleStart(); | 84 VisiblePosition startOfSelection = selection.visibleStart(); |
| 81 VisiblePosition endOfSelection = selection.visibleEnd(); | 85 VisiblePosition endOfSelection = selection.visibleEnd(); |
| 82 ASSERT(!startOfSelection.isNull()); | 86 ASSERT(!startOfSelection.isNull()); |
| 83 ASSERT(!endOfSelection.isNull()); | 87 ASSERT(!endOfSelection.isNull()); |
| 84 RefPtr<ContainerNode> startScope; | 88 RefPtr<ContainerNode> startScope; |
| 85 int startIndex = indexForVisiblePosition(startOfSelection, startScope); | 89 int startIndex = indexForVisiblePosition(startOfSelection, startScope); |
| 86 RefPtr<ContainerNode> endScope; | 90 RefPtr<ContainerNode> endScope; |
| 87 int endIndex = indexForVisiblePosition(endOfSelection, endScope); | 91 int endIndex = indexForVisiblePosition(endOfSelection, endScope); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 282 |
| 279 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const | 283 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const |
| 280 { | 284 { |
| 281 RefPtr<Element> element = createHTMLElement(document(), m_tagName); | 285 RefPtr<Element> element = createHTMLElement(document(), m_tagName); |
| 282 if (m_inlineStyle.length()) | 286 if (m_inlineStyle.length()) |
| 283 element->setAttribute(styleAttr, m_inlineStyle); | 287 element->setAttribute(styleAttr, m_inlineStyle); |
| 284 return element.release(); | 288 return element.release(); |
| 285 } | 289 } |
| 286 | 290 |
| 287 } | 291 } |
| OLD | NEW |