Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp

Issue 2929763002: Introduce InlineTextBoxesOf() for ease of loop over InlineTextBox of LayoutText (Closed)
Patch Set: 2017-06-08T17:21:30 Revise variable name in ComputeInlineBoxPositionTempalte to make patch size smaller Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 791
792 GetDocument().UpdateStyleAndLayout(); 792 GetDocument().UpdateStyleAndLayout();
793 793
794 LayoutText* text_layout_object = text_node->GetLayoutObject(); 794 LayoutText* text_layout_object = text_node->GetLayoutObject();
795 if (!text_layout_object) 795 if (!text_layout_object)
796 return; 796 return;
797 797
798 Vector<InlineTextBox*> sorted_text_boxes; 798 Vector<InlineTextBox*> sorted_text_boxes;
799 size_t sorted_text_boxes_position = 0; 799 size_t sorted_text_boxes_position = 0;
800 800
801 for (InlineTextBox* text_box = text_layout_object->FirstTextBox(); text_box; 801 for (InlineTextBox* text_box : InlineTextBoxesOf(*text_layout_object))
802 text_box = text_box->NextTextBox())
803 sorted_text_boxes.push_back(text_box); 802 sorted_text_boxes.push_back(text_box);
804 803
805 // If there is mixed directionality text, the boxes can be out of order, 804 // If there is mixed directionality text, the boxes can be out of order,
806 // (like Arabic with embedded LTR), so sort them first. 805 // (like Arabic with embedded LTR), so sort them first.
807 if (text_layout_object->ContainsReversedText()) 806 if (text_layout_object->ContainsReversedText())
808 std::sort(sorted_text_boxes.begin(), sorted_text_boxes.end(), 807 std::sort(sorted_text_boxes.begin(), sorted_text_boxes.end(),
809 InlineTextBox::CompareByStart); 808 InlineTextBox::CompareByStart);
810 InlineTextBox* box = sorted_text_boxes.IsEmpty() 809 InlineTextBox* box = sorted_text_boxes.IsEmpty()
811 ? 0 810 ? 0
812 : sorted_text_boxes[sorted_text_boxes_position]; 811 : sorted_text_boxes[sorted_text_boxes_position];
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 1974
1976 DEFINE_TRACE(CompositeEditCommand) { 1975 DEFINE_TRACE(CompositeEditCommand) {
1977 visitor->Trace(commands_); 1976 visitor->Trace(commands_);
1978 visitor->Trace(starting_selection_); 1977 visitor->Trace(starting_selection_);
1979 visitor->Trace(ending_selection_); 1978 visitor->Trace(ending_selection_);
1980 visitor->Trace(undo_step_); 1979 visitor->Trace(undo_step_);
1981 EditCommand::Trace(visitor); 1980 EditCommand::Trace(visitor);
1982 } 1981 }
1983 1982
1984 } // namespace blink 1983 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698