| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 InsertNodeAt(HTMLBRElement::Create(GetDocument()), | 1497 InsertNodeAt(HTMLBRElement::Create(GetDocument()), |
| 1498 before_paragraph.DeepEquivalent(), editing_state); | 1498 before_paragraph.DeepEquivalent(), editing_state); |
| 1499 if (editing_state->IsAborted()) | 1499 if (editing_state->IsAborted()) |
| 1500 return; | 1500 return; |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 // TextIterator::rangeLength requires clean layout. | 1503 // TextIterator::rangeLength requires clean layout. |
| 1504 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 1504 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 1505 | 1505 |
| 1506 destination_index = TextIterator::RangeLength( | 1506 destination_index = TextIterator::RangeLength( |
| 1507 Position::FirstPositionInNode(GetDocument().documentElement()), | 1507 Position::FirstPositionInNode(*GetDocument().documentElement()), |
| 1508 destination.ToParentAnchoredPosition(), | 1508 destination.ToParentAnchoredPosition(), |
| 1509 TextIteratorBehavior::AllVisiblePositionsRangeLengthBehavior()); | 1509 TextIteratorBehavior::AllVisiblePositionsRangeLengthBehavior()); |
| 1510 | 1510 |
| 1511 const SelectionInDOMTree& destination_selection = | 1511 const SelectionInDOMTree& destination_selection = |
| 1512 SelectionInDOMTree::Builder() | 1512 SelectionInDOMTree::Builder() |
| 1513 .Collapse(destination.ToPositionWithAffinity()) | 1513 .Collapse(destination.ToPositionWithAffinity()) |
| 1514 .SetIsDirectional(original_is_directional) | 1514 .SetIsDirectional(original_is_directional) |
| 1515 .Build(); | 1515 .Build(); |
| 1516 if (EndingSelection().IsNone()) { | 1516 if (EndingSelection().IsNone()) { |
| 1517 // We abort executing command since |destination| becomes invisible. | 1517 // We abort executing command since |destination| becomes invisible. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 editing_state); | 1671 editing_state); |
| 1672 if (editing_state->IsAborted()) | 1672 if (editing_state->IsAborted()) |
| 1673 return false; | 1673 return false; |
| 1674 } | 1674 } |
| 1675 | 1675 |
| 1676 AppendBlockPlaceholder(new_block, editing_state); | 1676 AppendBlockPlaceholder(new_block, editing_state); |
| 1677 if (editing_state->IsAborted()) | 1677 if (editing_state->IsAborted()) |
| 1678 return false; | 1678 return false; |
| 1679 | 1679 |
| 1680 SetEndingSelection(SelectionInDOMTree::Builder() | 1680 SetEndingSelection(SelectionInDOMTree::Builder() |
| 1681 .Collapse(Position::FirstPositionInNode(new_block)) | 1681 .Collapse(Position::FirstPositionInNode(*new_block)) |
| 1682 .SetIsDirectional(EndingSelection().IsDirectional()) | 1682 .SetIsDirectional(EndingSelection().IsDirectional()) |
| 1683 .Build()); | 1683 .Build()); |
| 1684 | 1684 |
| 1685 style->PrepareToApplyAt(EndingSelection().Start()); | 1685 style->PrepareToApplyAt(EndingSelection().Start()); |
| 1686 if (!style->IsEmpty()) { | 1686 if (!style->IsEmpty()) { |
| 1687 ApplyStyle(style, editing_state); | 1687 ApplyStyle(style, editing_state); |
| 1688 if (editing_state->IsAborted()) | 1688 if (editing_state->IsAborted()) |
| 1689 return false; | 1689 return false; |
| 1690 } | 1690 } |
| 1691 | 1691 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 | 1974 |
| 1975 DEFINE_TRACE(CompositeEditCommand) { | 1975 DEFINE_TRACE(CompositeEditCommand) { |
| 1976 visitor->Trace(commands_); | 1976 visitor->Trace(commands_); |
| 1977 visitor->Trace(starting_selection_); | 1977 visitor->Trace(starting_selection_); |
| 1978 visitor->Trace(ending_selection_); | 1978 visitor->Trace(ending_selection_); |
| 1979 visitor->Trace(undo_step_); | 1979 visitor->Trace(undo_step_); |
| 1980 EditCommand::Trace(visitor); | 1980 EditCommand::Trace(visitor); |
| 1981 } | 1981 } |
| 1982 | 1982 |
| 1983 } // namespace blink | 1983 } // namespace blink |
| OLD | NEW |