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

Side by Side Diff: Source/core/editing/VisiblePosition.cpp

Issue 1300823002: Introduce PositionAlgorithm<Strategy>::editingPositionOf() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T17:38:11 Created 5 years, 4 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 | « Source/core/editing/RenderedPosition.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('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, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (box->bidiLevel() == level) 241 if (box->bidiLevel() == level)
242 break; 242 break;
243 level = box->bidiLevel(); 243 level = box->bidiLevel();
244 } 244 }
245 layoutObject = &box->layoutObject(); 245 layoutObject = &box->layoutObject();
246 offset = primaryDirection == LTR ? box->caretMinOffset() : box-> caretMaxOffset(); 246 offset = primaryDirection == LTR ? box->caretMinOffset() : box-> caretMaxOffset();
247 } 247 }
248 break; 248 break;
249 } 249 }
250 250
251 p = createLegacyEditingPosition(layoutObject->node(), offset); 251 p = Position::editingPositionOf(layoutObject->node(), offset);
252 252
253 if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartO fTree() || p.atEndOfTree()) 253 if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartO fTree() || p.atEndOfTree())
254 return p; 254 return p;
255 255
256 ASSERT(p != m_deepPosition); 256 ASSERT(p != m_deepPosition);
257 } 257 }
258 } 258 }
259 259
260 VisiblePosition VisiblePosition::left() const 260 VisiblePosition VisiblePosition::left() const
261 { 261 {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 if (box->bidiLevel() == level) 403 if (box->bidiLevel() == level)
404 break; 404 break;
405 level = box->bidiLevel(); 405 level = box->bidiLevel();
406 } 406 }
407 layoutObject = &box->layoutObject(); 407 layoutObject = &box->layoutObject();
408 offset = primaryDirection == LTR ? box->caretMaxOffset() : box-> caretMinOffset(); 408 offset = primaryDirection == LTR ? box->caretMaxOffset() : box-> caretMinOffset();
409 } 409 }
410 break; 410 break;
411 } 411 }
412 412
413 p = createLegacyEditingPosition(layoutObject->node(), offset); 413 p = Position::editingPositionOf(layoutObject->node(), offset);
414 414
415 if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartO fTree() || p.atEndOfTree()) 415 if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartO fTree() || p.atEndOfTree())
416 return p; 416 return p;
417 417
418 ASSERT(p != m_deepPosition); 418 ASSERT(p != m_deepPosition);
419 } 419 }
420 } 420 }
421 421
422 VisiblePosition VisiblePosition::right() const 422 VisiblePosition VisiblePosition::right() const
423 { 423 {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 else 765 else
766 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); 766 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n");
767 } 767 }
768 768
769 void showTree(const blink::VisiblePosition& vpos) 769 void showTree(const blink::VisiblePosition& vpos)
770 { 770 {
771 vpos.showTreeForThis(); 771 vpos.showTreeForThis();
772 } 772 }
773 773
774 #endif 774 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/RenderedPosition.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698