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

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

Issue 1412713003: Reland 'Use FrameSelection::selectedText where possible.' Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reimplement setSelectionInTextFormControl: use setSelection. Created 5 years, 1 month 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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 m_selection.setIsDirectional(isDirectional); 159 m_selection.setIsDirectional(isDirectional);
160 m_selectionInComposedTree.setIsDirectional(isDirectional); 160 m_selectionInComposedTree.setIsDirectional(isDirectional);
161 } 161 }
162 162
163 void SelectionEditor::setWithoutValidation(const Position& start, const Position & end) 163 void SelectionEditor::setWithoutValidation(const Position& start, const Position & end)
164 { 164 {
165 m_selection.setWithoutValidation(start, end); 165 m_selection.setWithoutValidation(start, end);
166 adjustVisibleSelectionInComposedTree(); 166 adjustVisibleSelectionInComposedTree();
167 } 167 }
168 168
169 void SelectionEditor::setSelectionInTextFormControl(const Position& start, const Position& end)
170 {
171 m_selection.setWithoutValidation(start, end);
172 m_selectionInComposedTree.setWithoutValidation(toPositionInComposedTree(star t), toPositionInComposedTree(end));
173 }
174
169 TextDirection SelectionEditor::directionOfEnclosingBlock() 175 TextDirection SelectionEditor::directionOfEnclosingBlock()
170 { 176 {
171 return blink::directionOfEnclosingBlock(m_selection.extent()); 177 return blink::directionOfEnclosingBlock(m_selection.extent());
172 } 178 }
173 179
174 TextDirection SelectionEditor::directionOfSelection() 180 TextDirection SelectionEditor::directionOfSelection()
175 { 181 {
176 InlineBox* startBox = nullptr; 182 InlineBox* startBox = nullptr;
177 InlineBox* endBox = nullptr; 183 InlineBox* endBox = nullptr;
178 // Cache the VisiblePositions because visibleStart() and visibleEnd() 184 // Cache the VisiblePositions because visibleStart() and visibleEnd()
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 DEFINE_TRACE(SelectionEditor) 937 DEFINE_TRACE(SelectionEditor)
932 { 938 {
933 visitor->trace(m_frameSelection); 939 visitor->trace(m_frameSelection);
934 visitor->trace(m_selection); 940 visitor->trace(m_selection);
935 visitor->trace(m_selectionInComposedTree); 941 visitor->trace(m_selectionInComposedTree);
936 visitor->trace(m_logicalRange); 942 visitor->trace(m_logicalRange);
937 VisibleSelectionChangeObserver::trace(visitor); 943 VisibleSelectionChangeObserver::trace(visitor);
938 } 944 }
939 945
940 } // namespace blink 946 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698