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

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

Issue 2502413004: WTF/std normalization: replace WTF::Vector::last with ::back (Closed)
Patch Set: rebase Created 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 5 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
6 #include "core/dom/Document.h" 6 #include "core/dom/Document.h"
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/dom/Text.h" 8 #include "core/dom/Text.h"
9 #include "core/editing/FrameSelection.h" 9 #include "core/editing/FrameSelection.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 IntPoint wordMiddle((m_letterPos[wordStartIndex].x() + 142 IntPoint wordMiddle((m_letterPos[wordStartIndex].x() +
143 m_letterPos[i + wordStartIndexOffset].x()) / 143 m_letterPos[i + wordStartIndexOffset].x()) /
144 2, 144 2,
145 m_letterPos[wordStartIndex].y()); 145 m_letterPos[wordStartIndex].y());
146 m_wordMiddles.append(wordMiddle); 146 m_wordMiddles.append(wordMiddle);
147 wordStarted = false; 147 wordStarted = false;
148 } 148 }
149 } 149 }
150 } 150 }
151 if (wordStarted) { 151 if (wordStarted) {
152 const auto& lastNode = textNodes.last(); 152 const auto& lastNode = textNodes.back();
153 int xEnd = visiblePositionToContentsPoint( 153 int xEnd = visiblePositionToContentsPoint(
154 createVisiblePosition( 154 createVisiblePosition(
155 Position(lastNode, lastNode->wholeText().length()))) 155 Position(lastNode, lastNode->wholeText().length())))
156 .x(); 156 .x();
157 IntPoint wordMiddle((m_letterPos[wordStartIndex].x() + xEnd) / 2, 157 IntPoint wordMiddle((m_letterPos[wordStartIndex].x() + xEnd) / 2,
158 m_letterPos[wordStartIndex].y()); 158 m_letterPos[wordStartIndex].y());
159 m_wordMiddles.append(wordMiddle); 159 m_wordMiddles.append(wordMiddle);
160 } 160 }
161 } 161 }
162 162
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 selection().setSelection( 701 selection().setSelection(
702 SelectionInDOMTree::Builder() 702 SelectionInDOMTree::Builder()
703 .setBaseAndExtent(Position(text, 15), Position(text, 22)) 703 .setBaseAndExtent(Position(text, 15), Position(text, 22))
704 .build()); 704 .build());
705 EXPECT_EQ_SELECTED_TEXT("mnopqr "); 705 EXPECT_EQ_SELECTED_TEXT("mnopqr ");
706 selection().moveRangeSelectionExtent(m_wordMiddles[4]); 706 selection().moveRangeSelectionExtent(m_wordMiddles[4]);
707 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); 707 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin");
708 } 708 }
709 709
710 } // namespace blink 710 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698