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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 if (referenceRange) { | 1153 if (referenceRange) { |
1154 if (forward) | 1154 if (forward) |
1155 searchRange->setStart(startInReferenceRange ? referenceRange->startP
osition() : referenceRange->endPosition()); | 1155 searchRange->setStart(startInReferenceRange ? referenceRange->startP
osition() : referenceRange->endPosition()); |
1156 else | 1156 else |
1157 searchRange->setEnd(startInReferenceRange ? referenceRange->endPosit
ion() : referenceRange->startPosition()); | 1157 searchRange->setEnd(startInReferenceRange ? referenceRange->endPosit
ion() : referenceRange->startPosition()); |
1158 } | 1158 } |
1159 | 1159 |
1160 RefPtr<Node> shadowTreeRoot = referenceRange && referenceRange->startContain
er() ? referenceRange->startContainer()->nonBoundaryShadowTreeRootNode() : 0; | 1160 RefPtr<Node> shadowTreeRoot = referenceRange && referenceRange->startContain
er() ? referenceRange->startContainer()->nonBoundaryShadowTreeRootNode() : 0; |
1161 if (shadowTreeRoot) { | 1161 if (shadowTreeRoot) { |
1162 if (forward) | 1162 if (forward) |
1163 searchRange->setEnd(shadowTreeRoot.get(), shadowTreeRoot->childNodeC
ount()); | 1163 searchRange->setEnd(shadowTreeRoot.get(), shadowTreeRoot->countChild
ren()); |
1164 else | 1164 else |
1165 searchRange->setStart(shadowTreeRoot.get(), 0); | 1165 searchRange->setStart(shadowTreeRoot.get(), 0); |
1166 } | 1166 } |
1167 | 1167 |
1168 RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, options))
; | 1168 RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, options))
; |
1169 // If we started in the reference range and the found range exactly matches
the reference range, find again. | 1169 // If we started in the reference range and the found range exactly matches
the reference range, find again. |
1170 // Build a selection with the found range to remove collapsed whitespace. | 1170 // Build a selection with the found range to remove collapsed whitespace. |
1171 // Compare ranges instead of selection objects to ignore the way that the cu
rrent selection was made. | 1171 // Compare ranges instead of selection objects to ignore the way that the cu
rrent selection was made. |
1172 if (startInReferenceRange && areRangesEqual(VisibleSelection(resultRange.get
()).toNormalizedRange().get(), referenceRange)) { | 1172 if (startInReferenceRange && areRangesEqual(VisibleSelection(resultRange.get
()).toNormalizedRange().get(), referenceRange)) { |
1173 searchRange = rangeOfContents(m_frame.document()); | 1173 searchRange = rangeOfContents(m_frame.document()); |
1174 if (forward) | 1174 if (forward) |
1175 searchRange->setStart(referenceRange->endPosition()); | 1175 searchRange->setStart(referenceRange->endPosition()); |
1176 else | 1176 else |
1177 searchRange->setEnd(referenceRange->startPosition()); | 1177 searchRange->setEnd(referenceRange->startPosition()); |
1178 | 1178 |
1179 if (shadowTreeRoot) { | 1179 if (shadowTreeRoot) { |
1180 if (forward) | 1180 if (forward) |
1181 searchRange->setEnd(shadowTreeRoot.get(), shadowTreeRoot->childN
odeCount()); | 1181 searchRange->setEnd(shadowTreeRoot.get(), shadowTreeRoot->countC
hildren()); |
1182 else | 1182 else |
1183 searchRange->setStart(shadowTreeRoot.get(), 0); | 1183 searchRange->setStart(shadowTreeRoot.get(), 0); |
1184 } | 1184 } |
1185 | 1185 |
1186 resultRange = findPlainText(searchRange.get(), target, options); | 1186 resultRange = findPlainText(searchRange.get(), target, options); |
1187 } | 1187 } |
1188 | 1188 |
1189 // If nothing was found in the shadow tree, search in main content following
the shadow tree. | 1189 // If nothing was found in the shadow tree, search in main content following
the shadow tree. |
1190 if (resultRange->collapsed(ASSERT_NO_EXCEPTION) && shadowTreeRoot) { | 1190 if (resultRange->collapsed(ASSERT_NO_EXCEPTION) && shadowTreeRoot) { |
1191 searchRange = rangeOfContents(m_frame.document()); | 1191 searchRange = rangeOfContents(m_frame.document()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 return m_frame.spellChecker(); | 1231 return m_frame.spellChecker(); |
1232 } | 1232 } |
1233 | 1233 |
1234 void Editor::toggleOverwriteModeEnabled() | 1234 void Editor::toggleOverwriteModeEnabled() |
1235 { | 1235 { |
1236 m_overwriteModeEnabled = !m_overwriteModeEnabled; | 1236 m_overwriteModeEnabled = !m_overwriteModeEnabled; |
1237 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); | 1237 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); |
1238 } | 1238 } |
1239 | 1239 |
1240 } // namespace WebCore | 1240 } // namespace WebCore |
OLD | NEW |