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

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

Issue 2354893002: Introduce VisiblePosition::isValid (Closed)
Patch Set: 201609211817 Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisiblePosition.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void FrameSelection::moveTo(const Position &pos, TextAffinity affinity) 172 void FrameSelection::moveTo(const Position &pos, TextAffinity affinity)
173 { 173 {
174 SetSelectionOptions options = CloseTyping | ClearTypingStyle; 174 SetSelectionOptions options = CloseTyping | ClearTypingStyle;
175 setSelection(VisibleSelection(pos, affinity, selection().isDirectional()), o ptions); 175 setSelection(VisibleSelection(pos, affinity, selection().isDirectional()), o ptions);
176 } 176 }
177 177
178 // TODO(xiaochengh): We should not use reference to return value. 178 // TODO(xiaochengh): We should not use reference to return value.
179 template <typename Strategy> 179 template <typename Strategy>
180 static void adjustEndpointsAtBidiBoundary(VisiblePositionTemplate<Strategy>& vis ibleBase, VisiblePositionTemplate<Strategy>& visibleExtent) 180 static void adjustEndpointsAtBidiBoundary(VisiblePositionTemplate<Strategy>& vis ibleBase, VisiblePositionTemplate<Strategy>& visibleExtent)
181 { 181 {
182 // TODO(xiaochengh): Replace it with |DCHECK(visibleBase.isValid())| and 182 DCHECK(visibleBase.isValid());
183 // |DCHECK(visibleExtent.isValid())| once |VisiblePosition::isValid| is 183 DCHECK(visibleExtent.isValid());
184 // implemented.
185 DCHECK(visibleBase.isNull() || !visibleBase.deepEquivalent().document()->nee dsLayoutTreeUpdate());
186 184
187 RenderedPosition base(visibleBase); 185 RenderedPosition base(visibleBase);
188 RenderedPosition extent(visibleExtent); 186 RenderedPosition extent(visibleExtent);
189 187
190 if (base.isNull() || extent.isNull() || base.isEquivalent(extent)) 188 if (base.isNull() || extent.isNull() || base.isEquivalent(extent))
191 return; 189 return;
192 190
193 if (base.atLeftBoundaryOfBidiRun()) { 191 if (base.atLeftBoundaryOfBidiRun()) {
194 if (!extent.atRightBoundaryOfBidiRun(base.bidiLevelOnRight()) 192 if (!extent.atRightBoundaryOfBidiRun(base.bidiLevelOnRight())
195 && base.isEquivalent(extent.leftBoundaryOfBidiRun(base.bidiLevelOnRi ght()))) { 193 && base.isEquivalent(extent.leftBoundaryOfBidiRun(base.bidiLevelOnRi ght()))) {
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 1392
1395 void showTree(const blink::FrameSelection* sel) 1393 void showTree(const blink::FrameSelection* sel)
1396 { 1394 {
1397 if (sel) 1395 if (sel)
1398 sel->showTreeForThis(); 1396 sel->showTreeForThis();
1399 else 1397 else
1400 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1398 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1401 } 1399 }
1402 1400
1403 #endif 1401 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisiblePosition.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698