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

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

Issue 1994043002: Get rid of a redundant function alias lastPositionInNode() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-05-19T14:50:30 Created 4 years, 7 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 66
67 // The forward range starts at the selection end and ends at the document's 67 // 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 68 // end. It will then be updated to only contain the text in the text in the
69 // right range around the selection. 69 // right range around the selection.
70 CharacterIterator forwardIterator(endPosition, lastPositionInNode(document-> documentElement()).parentAnchoredEquivalent(), TextIteratorStopsOnFormControls); 70 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? 71 // FIXME: why do we stop going trough the text if we were not able to select something on the right?
72 if (!forwardIterator.atEnd()) 72 if (!forwardIterator.atEnd())
73 forwardIterator.advance(maxLength - halfMaxLength); 73 forwardIterator.advance(maxLength - halfMaxLength);
74 74
75 EphemeralRange forwardRange = forwardIterator.range(); 75 EphemeralRange forwardRange = forwardIterator.range();
76 if (forwardRange.isNull() || !Range::create(*document, endPosition, forwardR ange.startPosition())->text().length()) 76 if (forwardRange.isNull() || !Range::create(*document, endPosition, forwardR ange.startPosition())->text().length())
77 return; 77 return;
78 78
79 // Same as with the forward range but with the backward range. The range 79 // Same as with the forward range but with the backward range. The range
80 // starts at the document's start and ends at the selection start and will 80 // starts at the document's start and ends at the selection start and will
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 { 121 {
122 return m_startOffsetInContent; 122 return m_startOffsetInContent;
123 } 123 }
124 124
125 unsigned SurroundingText::endOffsetInContent() const 125 unsigned SurroundingText::endOffsetInContent() const
126 { 126 {
127 return m_endOffsetInContent; 127 return m_endOffsetInContent;
128 } 128 }
129 129
130 } // namespace blink 130 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Position.h ('k') | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698