| 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 * | 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // Re-canonicalize visible{Start,End}OfParagraph, make them valid again | 288 // Re-canonicalize visible{Start,End}OfParagraph, make them valid again |
| 289 // after DOM change. | 289 // after DOM change. |
| 290 // TODO(xiaochengh): We should not store a VisiblePosition and later inspect | 290 // TODO(xiaochengh): We should not store a VisiblePosition and later inspect |
| 291 // its properties when it is already invalidated. | 291 // its properties when it is already invalidated. |
| 292 visibleStartOfParagraph = | 292 visibleStartOfParagraph = |
| 293 createVisiblePosition(visibleStartOfParagraph.toPositionWithAffinity()); | 293 createVisiblePosition(visibleStartOfParagraph.toPositionWithAffinity()); |
| 294 visibleEndOfParagraph = | 294 visibleEndOfParagraph = |
| 295 createVisiblePosition(visibleEndOfParagraph.toPositionWithAffinity()); | 295 createVisiblePosition(visibleEndOfParagraph.toPositionWithAffinity()); |
| 296 } | 296 } |
| 297 | 297 |
| 298 // TODO(xiaochengh): We should not store a VisiblePosition and later inspect |
| 299 // its properties when it is already invalidated. |
| 298 VisiblePosition startOfParagraphToMove = | 300 VisiblePosition startOfParagraphToMove = |
| 299 startOfParagraph(visibleStartOfParagraph); | 301 startOfParagraph(visibleStartOfParagraph); |
| 300 VisiblePosition endOfParagraphToMove = endOfParagraph(visibleEndOfParagraph); | 302 VisiblePosition endOfParagraphToMove = endOfParagraph(visibleEndOfParagraph); |
| 301 if (startOfParagraphToMove.isNull() || endOfParagraphToMove.isNull()) | 303 if (startOfParagraphToMove.isNull() || endOfParagraphToMove.isNull()) |
| 302 return; | 304 return; |
| 303 HTMLBRElement* placeholder = HTMLBRElement::create(document()); | 305 HTMLBRElement* placeholder = HTMLBRElement::create(document()); |
| 304 insertNodeBefore(placeholder, splitBlockquoteNode, editingState); | 306 insertNodeBefore(placeholder, splitBlockquoteNode, editingState); |
| 305 if (editingState->isAborted()) | 307 if (editingState->isAborted()) |
| 306 return; | 308 return; |
| 307 | 309 |
| 308 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 310 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 311 startOfParagraphToMove = |
| 312 createVisiblePosition(startOfParagraphToMove.toPositionWithAffinity()); |
| 313 endOfParagraphToMove = |
| 314 createVisiblePosition(endOfParagraphToMove.toPositionWithAffinity()); |
| 309 moveParagraph(startOfParagraphToMove, endOfParagraphToMove, | 315 moveParagraph(startOfParagraphToMove, endOfParagraphToMove, |
| 310 VisiblePosition::beforeNode(placeholder), editingState, | 316 VisiblePosition::beforeNode(placeholder), editingState, |
| 311 PreserveSelection); | 317 PreserveSelection); |
| 312 } | 318 } |
| 313 | 319 |
| 314 // FIXME: We should merge this function with | 320 // FIXME: We should merge this function with |
| 315 // ApplyBlockElementCommand::formatSelection | 321 // ApplyBlockElementCommand::formatSelection |
| 316 void IndentOutdentCommand::outdentRegion( | 322 void IndentOutdentCommand::outdentRegion( |
| 317 const VisiblePosition& startOfSelection, | 323 const VisiblePosition& startOfSelection, |
| 318 const VisiblePosition& endOfSelection, | 324 const VisiblePosition& endOfSelection, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 else | 394 else |
| 389 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); | 395 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); |
| 390 } | 396 } |
| 391 | 397 |
| 392 InputEvent::InputType IndentOutdentCommand::inputType() const { | 398 InputEvent::InputType IndentOutdentCommand::inputType() const { |
| 393 return m_typeOfAction == Indent ? InputEvent::InputType::Indent | 399 return m_typeOfAction == Indent ? InputEvent::InputType::Indent |
| 394 : InputEvent::InputType::Outdent; | 400 : InputEvent::InputType::Outdent; |
| 395 } | 401 } |
| 396 | 402 |
| 397 } // namespace blink | 403 } // namespace blink |
| OLD | NEW |