Chromium Code Reviews| Index: pdf/pdfium/pdfium_engine.cc |
| diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
| index e6713271139afb89d816956c6a3d07bbd1b41917..da3931dc9c933c37587f9e5caa65934e5e589671 100644 |
| --- a/pdf/pdfium/pdfium_engine.cc |
| +++ b/pdf/pdfium/pdfium_engine.cc |
| @@ -1629,6 +1629,13 @@ void PDFiumEngine::StartFind(const char* text, bool case_sensitive) { |
| if (end_of_search) { |
| // Send the final notification. |
| client_->NotifyNumberOfFindResultsChanged(find_results_.size(), true); |
| + |
| + // Restore find result state when find is started after rotation. |
| + if (find_result_state_.find_index_ != -1) { |
|
raymes
2014/09/24 03:57:50
It doesn't look like we need a new struct, it look
Nikhil
2014/09/29 08:22:11
Thanks, I've modified the code accordingly. Please
|
| + current_find_index_ = find_result_state_.find_index_ - 1; |
| + SelectFindResult(true); |
| + find_result_state_ = FindResultState(); |
| + } |
| } else { |
| pp::CompletionCallback callback = |
| find_factory_.NewCallback(&PDFiumEngine::ContinueFind); |
| @@ -1832,18 +1839,31 @@ void PDFiumEngine::ZoomUpdated(double new_zoom_level) { |
| void PDFiumEngine::RotateClockwise() { |
| current_rotation_ = (current_rotation_ + 1) % 4; |
| + find_result_state_ = FindResultState(current_find_text_, current_find_index_); |
| + |
| InvalidateAllPages(); |
| + |
| + // Restore find state if needed. |
|
raymes
2014/09/24 03:57:50
// Store the current find index so that we can res
Nikhil
2014/09/29 08:22:11
Done.
|
| + if (!find_result_state_.find_text_.empty()) |
| + StartFind(find_result_state_.find_text_.c_str(), false); |
|
raymes
2014/09/22 05:16:45
I don't fully understand the find stuff but can we
Nikhil
2014/09/23 12:18:08
The problem that I faced earlier with this code fl
raymes
2014/09/24 03:57:50
Ah I see how StartFind is asynchronous now, thanks
Nikhil
2014/09/29 08:22:11
Acknowledged.
|
| } |
| void PDFiumEngine::RotateCounterclockwise() { |
| current_rotation_ = (current_rotation_ - 1) % 4; |
| + find_result_state_ = FindResultState(current_find_text_, current_find_index_); |
| + |
| InvalidateAllPages(); |
| + |
| + // Restore find state if needed. |
| + if (!find_result_state_.find_text_.empty()) |
| + StartFind(find_result_state_.find_text_.c_str(), false); |
| } |
| void PDFiumEngine::InvalidateAllPages() { |
| selection_.clear(); |
| find_results_.clear(); |
|
raymes
2014/09/24 03:57:50
These two lines and UpdateTickMarks() are already
Nikhil
2014/09/29 08:22:11
Done.
|
| + StopFind(); |
|
raymes
2014/09/24 03:57:50
You might want to move this after CancelPaints() t
Nikhil
2014/09/29 08:22:11
Done.
|
| CancelPaints(); |
| LoadPageInfo(true); |
| UpdateTickMarks(); |