OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 } | 626 } |
627 | 627 |
628 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 628 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
629 | 629 |
630 // FIXME: Tolerate differences in id, class, and style attributes. | 630 // FIXME: Tolerate differences in id, class, and style attributes. |
631 if (element->parentNode() && IsNonTableCellHTMLBlockElement(element) && | 631 if (element->parentNode() && IsNonTableCellHTMLBlockElement(element) && |
632 AreIdenticalElements(*element, *element->parentNode()) && | 632 AreIdenticalElements(*element, *element->parentNode()) && |
633 VisiblePosition::FirstPositionInNode(*element->parentNode()) | 633 VisiblePosition::FirstPositionInNode(*element->parentNode()) |
634 .DeepEquivalent() == | 634 .DeepEquivalent() == |
635 VisiblePosition::FirstPositionInNode(*element).DeepEquivalent() && | 635 VisiblePosition::FirstPositionInNode(*element).DeepEquivalent() && |
636 VisiblePosition::LastPositionInNode(element->parentNode()) | 636 VisiblePosition::LastPositionInNode(*element->parentNode()) |
637 .DeepEquivalent() == | 637 .DeepEquivalent() == |
638 VisiblePosition::LastPositionInNode(element).DeepEquivalent()) { | 638 VisiblePosition::LastPositionInNode(*element).DeepEquivalent()) { |
639 inserted_nodes.WillRemoveNodePreservingChildren(*element); | 639 inserted_nodes.WillRemoveNodePreservingChildren(*element); |
640 RemoveNodePreservingChildren(element, editing_state); | 640 RemoveNodePreservingChildren(element, editing_state); |
641 if (editing_state->IsAborted()) | 641 if (editing_state->IsAborted()) |
642 return; | 642 return; |
643 continue; | 643 continue; |
644 } | 644 } |
645 | 645 |
646 if (element->parentNode() && | 646 if (element->parentNode() && |
647 HasRichlyEditableStyle(*element->parentNode()) && | 647 HasRichlyEditableStyle(*element->parentNode()) && |
648 HasRichlyEditableStyle(*element)) { | 648 HasRichlyEditableStyle(*element)) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 Element* element, | 728 Element* element, |
729 Element* ancestor, | 729 Element* ancestor, |
730 EditingState* editing_state) { | 730 EditingState* editing_state) { |
731 if (!HasEditableStyle(*ancestor->parentNode())) | 731 if (!HasEditableStyle(*ancestor->parentNode())) |
732 return; | 732 return; |
733 | 733 |
734 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 734 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
735 VisiblePosition position_at_end_of_node = | 735 VisiblePosition position_at_end_of_node = |
736 CreateVisiblePosition(LastPositionInOrAfterNode(element)); | 736 CreateVisiblePosition(LastPositionInOrAfterNode(element)); |
737 VisiblePosition last_position_in_paragraph = | 737 VisiblePosition last_position_in_paragraph = |
738 VisiblePosition::LastPositionInNode(ancestor); | 738 VisiblePosition::LastPositionInNode(*ancestor); |
739 if (position_at_end_of_node.DeepEquivalent() == | 739 if (position_at_end_of_node.DeepEquivalent() == |
740 last_position_in_paragraph.DeepEquivalent()) { | 740 last_position_in_paragraph.DeepEquivalent()) { |
741 RemoveNode(element, editing_state); | 741 RemoveNode(element, editing_state); |
742 if (editing_state->IsAborted()) | 742 if (editing_state->IsAborted()) |
743 return; | 743 return; |
744 if (ancestor->nextSibling()) | 744 if (ancestor->nextSibling()) |
745 InsertNodeBefore(element, ancestor->nextSibling(), editing_state); | 745 InsertNodeBefore(element, ancestor->nextSibling(), editing_state); |
746 else | 746 else |
747 AppendNode(element, ancestor->parentNode(), editing_state); | 747 AppendNode(element, ancestor->parentNode(), editing_state); |
748 if (editing_state->IsAborted()) | 748 if (editing_state->IsAborted()) |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 visitor->Trace(start_of_inserted_content_); | 2010 visitor->Trace(start_of_inserted_content_); |
2011 visitor->Trace(end_of_inserted_content_); | 2011 visitor->Trace(end_of_inserted_content_); |
2012 visitor->Trace(insertion_style_); | 2012 visitor->Trace(insertion_style_); |
2013 visitor->Trace(document_fragment_); | 2013 visitor->Trace(document_fragment_); |
2014 visitor->Trace(start_of_inserted_range_); | 2014 visitor->Trace(start_of_inserted_range_); |
2015 visitor->Trace(end_of_inserted_range_); | 2015 visitor->Trace(end_of_inserted_range_); |
2016 CompositeEditCommand::Trace(visitor); | 2016 CompositeEditCommand::Trace(visitor); |
2017 } | 2017 } |
2018 | 2018 |
2019 } // namespace blink | 2019 } // namespace blink |
OLD | NEW |