| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 // boundaries, however we can do it without |Range| object. | 1184 // boundaries, however we can do it without |Range| object. |
| 1185 template <typename Strategy> | 1185 template <typename Strategy> |
| 1186 static PassRefPtrWillBeRawPtr<Range> findStringBetweenPositions(const String& ta
rget, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions option
s) | 1186 static PassRefPtrWillBeRawPtr<Range> findStringBetweenPositions(const String& ta
rget, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions option
s) |
| 1187 { | 1187 { |
| 1188 EphemeralRangeTemplate<Strategy> searchRange(referenceRange); | 1188 EphemeralRangeTemplate<Strategy> searchRange(referenceRange); |
| 1189 | 1189 |
| 1190 bool forward = !(options & Backwards); | 1190 bool forward = !(options & Backwards); |
| 1191 | 1191 |
| 1192 while (true) { | 1192 while (true) { |
| 1193 EphemeralRangeTemplate<Strategy> resultRange = findPlainText(searchRange
, target, options); | 1193 EphemeralRangeTemplate<Strategy> resultRange = findPlainText(searchRange
, target, options); |
| 1194 if (resultRange.isCollapsed()) | 1194 if (resultRange.isCollapsed()) { |
| 1195 if (resultRange.endPosition() != searchRange.endPosition()) { |
| 1196 // Possibly whitespace spans over multiple TreeScopes. |
| 1197 // We skip this match and seek for the next occurance. |
| 1198 if (forward) { |
| 1199 searchRange = EphemeralRangeTemplate<Strategy>(nextPositionO
f(resultRange.startPosition(), PositionMoveType::CodePoint), searchRange.endPosi
tion()); |
| 1200 } else { |
| 1201 searchRange = EphemeralRangeTemplate<Strategy>(searchRange.s
tartPosition(), previousPositionOf(resultRange.endPosition(), PositionMoveType::
CodePoint)); |
| 1202 } |
| 1203 continue; |
| 1204 } |
| 1195 return nullptr; | 1205 return nullptr; |
| 1206 } |
| 1196 | 1207 |
| 1197 RefPtrWillBeRawPtr<Range> rangeObject = Range::create(resultRange.docume
nt(), toPositionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resu
ltRange.endPosition())); | 1208 RefPtrWillBeRawPtr<Range> rangeObject = Range::create(resultRange.docume
nt(), toPositionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resu
ltRange.endPosition())); |
| 1198 if (!rangeObject->collapsed()) | 1209 if (!rangeObject->collapsed()) |
| 1199 return rangeObject.release(); | 1210 return rangeObject.release(); |
| 1200 | 1211 |
| 1201 // Found text spans over multiple TreeScopes. Since it's impossible to | 1212 // Found text spans over multiple TreeScopes. Since it's impossible to |
| 1202 // return such section as a Range, we skip this match and seek for the | 1213 // return such section as a Range, we skip this match and seek for the |
| 1203 // next occurrence. | 1214 // next occurrence. |
| 1204 // TODO(yosin) Handle this case. | 1215 // TODO(yosin) Handle this case. |
| 1205 if (forward) { | 1216 if (forward) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 } | 1312 } |
| 1302 | 1313 |
| 1303 DEFINE_TRACE(Editor) | 1314 DEFINE_TRACE(Editor) |
| 1304 { | 1315 { |
| 1305 visitor->trace(m_frame); | 1316 visitor->trace(m_frame); |
| 1306 visitor->trace(m_lastEditCommand); | 1317 visitor->trace(m_lastEditCommand); |
| 1307 visitor->trace(m_mark); | 1318 visitor->trace(m_mark); |
| 1308 } | 1319 } |
| 1309 | 1320 |
| 1310 } // namespace blink | 1321 } // namespace blink |
| OLD | NEW |