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 setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(Ca nnotCrossEditingBoundary), endingSelection().isDirectional())); |
78 if (endingSelection().isNone()) | |
Yuta Kitamura
2014/05/20 09:44:36
Is this logic equivalent to the following?
Vi
yosin_UTC9
2014/05/21 03:44:07
Done.
Yes, you're right. Your version is better t
| |
79 return; | |
80 } | |
78 | 81 |
79 VisibleSelection selection = selectionForParagraphIteration(endingSelection( )); | 82 VisibleSelection selection = selectionForParagraphIteration(endingSelection( )); |
80 VisiblePosition startOfSelection = selection.visibleStart(); | 83 VisiblePosition startOfSelection = selection.visibleStart(); |
81 VisiblePosition endOfSelection = selection.visibleEnd(); | 84 VisiblePosition endOfSelection = selection.visibleEnd(); |
82 ASSERT(!startOfSelection.isNull()); | 85 ASSERT(!startOfSelection.isNull()); |
83 ASSERT(!endOfSelection.isNull()); | 86 ASSERT(!endOfSelection.isNull()); |
84 RefPtr<ContainerNode> startScope; | 87 RefPtr<ContainerNode> startScope; |
85 int startIndex = indexForVisiblePosition(startOfSelection, startScope); | 88 int startIndex = indexForVisiblePosition(startOfSelection, startScope); |
86 RefPtr<ContainerNode> endScope; | 89 RefPtr<ContainerNode> endScope; |
87 int endIndex = indexForVisiblePosition(endOfSelection, endScope); | 90 int endIndex = indexForVisiblePosition(endOfSelection, endScope); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 | 281 |
279 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const | 282 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const |
280 { | 283 { |
281 RefPtr<Element> element = createHTMLElement(document(), m_tagName); | 284 RefPtr<Element> element = createHTMLElement(document(), m_tagName); |
282 if (m_inlineStyle.length()) | 285 if (m_inlineStyle.length()) |
283 element->setAttribute(styleAttr, m_inlineStyle); | 286 element->setAttribute(styleAttr, m_inlineStyle); |
284 return element.release(); | 287 return element.release(); |
285 } | 288 } |
286 | 289 |
287 } | 290 } |
OLD | NEW |