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

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

Issue 2350303003: Prune CreateVisiblePositionDeprecated from SurroundingText-related callers (Closed)
Patch Set: Address comments Created 4 years, 3 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/testing/Internals.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void SurroundingText::initialize(const Position& startPosition, const Position& endPosition, unsigned maxLength) 56 void SurroundingText::initialize(const Position& startPosition, const Position& endPosition, unsigned maxLength)
57 { 57 {
58 DCHECK_EQ(startPosition.document(), endPosition.document()); 58 DCHECK_EQ(startPosition.document(), endPosition.document());
59 59
60 const unsigned halfMaxLength = maxLength / 2; 60 const unsigned halfMaxLength = maxLength / 2;
61 61
62 Document* document = startPosition.document(); 62 Document* document = startPosition.document();
63 // The position will have no document if it is null (as in no position). 63 // The position will have no document if it is null (as in no position).
64 if (!document || !document->documentElement()) 64 if (!document || !document->documentElement())
65 return; 65 return;
66 DCHECK(!document->needsLayoutTreeUpdate());
66 67
67 // The forward range starts at the selection end and ends at the document's 68 // The forward range starts at the selection end and ends at the document's
68 // end. It will then be updated to only contain the text in the text in the 69 // end. It will then be updated to only contain the text in the text in the
69 // right range around the selection. 70 // right range around the selection.
70 CharacterIterator forwardIterator(endPosition, Position::lastPositionInNode( document->documentElement()).parentAnchoredEquivalent(), TextIteratorStopsOnForm Controls); 71 CharacterIterator forwardIterator(endPosition, Position::lastPositionInNode( document->documentElement()).parentAnchoredEquivalent(), TextIteratorStopsOnForm Controls);
71 // FIXME: why do we stop going trough the text if we were not able to select something on the right? 72 // FIXME: why do we stop going trough the text if we were not able to select something on the right?
72 if (!forwardIterator.atEnd()) 73 if (!forwardIterator.atEnd())
73 forwardIterator.advance(maxLength - halfMaxLength); 74 forwardIterator.advance(maxLength - halfMaxLength);
74 75
75 EphemeralRange forwardRange = forwardIterator.range(); 76 EphemeralRange forwardRange = forwardIterator.range();
(...skipping 24 matching lines...) Expand all
100 { 101 {
101 return m_startOffsetInContent; 102 return m_startOffsetInContent;
102 } 103 }
103 104
104 unsigned SurroundingText::endOffsetInContent() const 105 unsigned SurroundingText::endOffsetInContent() const
105 { 106 {
106 return m_endOffsetInContent; 107 return m_endOffsetInContent;
107 } 108 }
108 109
109 } // namespace blink 110 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698