| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/editing/spellcheck/ColdModeSpellCheckRequester.h" | 5 #include "core/editing/spellcheck/ColdModeSpellCheckRequester.h" |
| 6 | 6 |
| 7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
| 8 #include "core/dom/IdleDeadline.h" | 8 #include "core/dom/IdleDeadline.h" |
| 9 #include "core/editing/EditingUtilities.h" | 9 #include "core/editing/EditingUtilities.h" |
| 10 #include "core/editing/VisibleUnits.h" | 10 #include "core/editing/VisibleUnits.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (current_full_length_ <= kColdModeChunkSize) { | 142 if (current_full_length_ <= kColdModeChunkSize) { |
| 143 GetSpellCheckRequester().RequestCheckingFor( | 143 GetSpellCheckRequester().RequestCheckingFor( |
| 144 EphemeralRange::RangeOfContents(*current_root_editable_)); | 144 EphemeralRange::RangeOfContents(*current_root_editable_)); |
| 145 FinishCheckingCurrentRootEditable(); | 145 FinishCheckingCurrentRootEditable(); |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 | 148 |
| 149 const Position& chunk_end = | 149 const Position& chunk_end = |
| 150 CalculateCharacterSubrange( | 150 CalculateCharacterSubrange( |
| 151 EphemeralRange(current_chunk_start_, | 151 EphemeralRange(current_chunk_start_, |
| 152 Position::LastPositionInNode(current_root_editable_)), | 152 Position::LastPositionInNode(*current_root_editable_)), |
| 153 0, kColdModeChunkSize) | 153 0, kColdModeChunkSize) |
| 154 .EndPosition(); | 154 .EndPosition(); |
| 155 if (chunk_end <= current_chunk_start_) { | 155 if (chunk_end <= current_chunk_start_) { |
| 156 FinishCheckingCurrentRootEditable(); | 156 FinishCheckingCurrentRootEditable(); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 const EphemeralRange chunk_range(current_chunk_start_, chunk_end); | 159 const EphemeralRange chunk_range(current_chunk_start_, chunk_end); |
| 160 const EphemeralRange& check_range = ExpandEndToSentenceBoundary(chunk_range); | 160 const EphemeralRange& check_range = ExpandEndToSentenceBoundary(chunk_range); |
| 161 GetSpellCheckRequester().RequestCheckingFor(check_range, | 161 GetSpellCheckRequester().RequestCheckingFor(check_range, |
| 162 current_chunk_index_); | 162 current_chunk_index_); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 173 next_node_ = FlatTreeTraversal::NextSkippingChildren( | 173 next_node_ = FlatTreeTraversal::NextSkippingChildren( |
| 174 *next_node_, GetFrame().GetDocument()->body()); | 174 *next_node_, GetFrame().GetDocument()->body()); |
| 175 | 175 |
| 176 current_root_editable_ = nullptr; | 176 current_root_editable_ = nullptr; |
| 177 current_full_length_ = kInvalidLength; | 177 current_full_length_ = kInvalidLength; |
| 178 current_chunk_index_ = kInvalidChunkIndex; | 178 current_chunk_index_ = kInvalidChunkIndex; |
| 179 current_chunk_start_ = Position(); | 179 current_chunk_start_ = Position(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |