| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 EditingState* editing_state) { | 345 EditingState* editing_state) { |
| 346 VisiblePosition end_of_current_paragraph = EndOfParagraph(start_of_selection); | 346 VisiblePosition end_of_current_paragraph = EndOfParagraph(start_of_selection); |
| 347 VisiblePosition end_of_last_paragraph = EndOfParagraph(end_of_selection); | 347 VisiblePosition end_of_last_paragraph = EndOfParagraph(end_of_selection); |
| 348 | 348 |
| 349 if (end_of_current_paragraph.DeepEquivalent() == | 349 if (end_of_current_paragraph.DeepEquivalent() == |
| 350 end_of_last_paragraph.DeepEquivalent()) { | 350 end_of_last_paragraph.DeepEquivalent()) { |
| 351 OutdentParagraph(editing_state); | 351 OutdentParagraph(editing_state); |
| 352 return; | 352 return; |
| 353 } | 353 } |
| 354 | 354 |
| 355 Position original_selection_end = EndingSelection().end(); | 355 Position original_selection_end = EndingSelection().End(); |
| 356 Position end_after_selection = | 356 Position end_after_selection = |
| 357 EndOfParagraph(NextPositionOf(end_of_last_paragraph)).DeepEquivalent(); | 357 EndOfParagraph(NextPositionOf(end_of_last_paragraph)).DeepEquivalent(); |
| 358 | 358 |
| 359 while (end_of_current_paragraph.DeepEquivalent() != end_after_selection) { | 359 while (end_of_current_paragraph.DeepEquivalent() != end_after_selection) { |
| 360 PositionWithAffinity end_of_next_paragraph = | 360 PositionWithAffinity end_of_next_paragraph = |
| 361 EndOfParagraph(NextPositionOf(end_of_current_paragraph)) | 361 EndOfParagraph(NextPositionOf(end_of_current_paragraph)) |
| 362 .ToPositionWithAffinity(); | 362 .ToPositionWithAffinity(); |
| 363 if (end_of_current_paragraph.DeepEquivalent() == | 363 if (end_of_current_paragraph.DeepEquivalent() == |
| 364 end_of_last_paragraph.DeepEquivalent()) { | 364 end_of_last_paragraph.DeepEquivalent()) { |
| 365 SelectionInDOMTree::Builder builder; | 365 SelectionInDOMTree::Builder builder; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 379 | 379 |
| 380 // outdentParagraph could move more than one paragraph if the paragraph | 380 // outdentParagraph could move more than one paragraph if the paragraph |
| 381 // is in a list item. As a result, endAfterSelection and endOfNextParagraph | 381 // is in a list item. As a result, endAfterSelection and endOfNextParagraph |
| 382 // could refer to positions no longer in the document. | 382 // could refer to positions no longer in the document. |
| 383 if (end_after_selection.IsNotNull() && !end_after_selection.IsConnected()) | 383 if (end_after_selection.IsNotNull() && !end_after_selection.IsConnected()) |
| 384 break; | 384 break; |
| 385 | 385 |
| 386 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 386 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 387 if (end_of_next_paragraph.IsNotNull() && | 387 if (end_of_next_paragraph.IsNotNull() && |
| 388 !end_of_next_paragraph.IsConnected()) { | 388 !end_of_next_paragraph.IsConnected()) { |
| 389 end_of_current_paragraph = CreateVisiblePosition(EndingSelection().end()); | 389 end_of_current_paragraph = CreateVisiblePosition(EndingSelection().End()); |
| 390 end_of_next_paragraph = | 390 end_of_next_paragraph = |
| 391 EndOfParagraph(NextPositionOf(end_of_current_paragraph)) | 391 EndOfParagraph(NextPositionOf(end_of_current_paragraph)) |
| 392 .ToPositionWithAffinity(); | 392 .ToPositionWithAffinity(); |
| 393 } | 393 } |
| 394 end_of_current_paragraph = CreateVisiblePosition(end_of_next_paragraph); | 394 end_of_current_paragraph = CreateVisiblePosition(end_of_next_paragraph); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 void IndentOutdentCommand::FormatSelection( | 398 void IndentOutdentCommand::FormatSelection( |
| 399 const VisiblePosition& start_of_selection, | 399 const VisiblePosition& start_of_selection, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 420 else | 420 else |
| 421 IndentIntoBlockquote(start, end, blockquote_for_next_indent, editing_state); | 421 IndentIntoBlockquote(start, end, blockquote_for_next_indent, editing_state); |
| 422 } | 422 } |
| 423 | 423 |
| 424 InputEvent::InputType IndentOutdentCommand::GetInputType() const { | 424 InputEvent::InputType IndentOutdentCommand::GetInputType() const { |
| 425 return type_of_action_ == kIndent ? InputEvent::InputType::kFormatIndent | 425 return type_of_action_ == kIndent ? InputEvent::InputType::kFormatIndent |
| 426 : InputEvent::InputType::kFormatOutdent; | 426 : InputEvent::InputType::kFormatOutdent; |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace blink | 429 } // namespace blink |
| OLD | NEW |