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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 Document* document = startPosition.document(); 59 Document* document = startPosition.document();
60 // The position will have no document if it is null (as in no position). 60 // The position will have no document if it is null (as in no position).
61 if (!document || !document->documentElement()) 61 if (!document || !document->documentElement())
62 return; 62 return;
63 DCHECK(!document->needsLayoutTreeUpdate()); 63 DCHECK(!document->needsLayoutTreeUpdate());
64 64
65 // The forward range starts at the selection end and ends at the document's 65 // The forward range starts at the selection end and ends at the document's
66 // end. It will then be updated to only contain the text in the text in the 66 // end. It will then be updated to only contain the text in the text in the
67 // right range around the selection. 67 // right range around the selection.
68 CharacterIterator forwardIterator( 68 CharacterIterator forwardIterator(
69 endPosition, Position::lastPositionInNode(document->documentElement()) 69 endPosition,
70 .parentAnchoredEquivalent(), 70 Position::lastPositionInNode(document->documentElement())
71 .parentAnchoredEquivalent(),
71 TextIteratorBehavior::Builder().setStopsOnFormControls(true).build()); 72 TextIteratorBehavior::Builder().setStopsOnFormControls(true).build());
72 // FIXME: why do we stop going trough the text if we were not able to select 73 // FIXME: why do we stop going trough the text if we were not able to select
73 // something on the right? 74 // something on the right?
74 if (!forwardIterator.atEnd()) 75 if (!forwardIterator.atEnd())
75 forwardIterator.advance(maxLength - halfMaxLength); 76 forwardIterator.advance(maxLength - halfMaxLength);
76 77
77 EphemeralRange forwardRange = forwardIterator.range(); 78 EphemeralRange forwardRange = forwardIterator.range();
78 if (forwardRange.isNull() || 79 if (forwardRange.isNull() ||
79 !Range::create(*document, endPosition, forwardRange.startPosition()) 80 !Range::create(*document, endPosition, forwardRange.startPosition())
80 ->text() 81 ->text()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 118
118 unsigned SurroundingText::startOffsetInContent() const { 119 unsigned SurroundingText::startOffsetInContent() const {
119 return m_startOffsetInContent; 120 return m_startOffsetInContent;
120 } 121 }
121 122
122 unsigned SurroundingText::endOffsetInContent() const { 123 unsigned SurroundingText::endOffsetInContent() const {
123 return m_endOffsetInContent; 124 return m_endOffsetInContent;
124 } 125 }
125 126
126 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698